two-phase-commit implementation