2pc-locks-released-on-both-paths

Status: IN

Locks held by a transaction are released regardless of whether the transaction commits or aborts, preventing deadlocks across sequential transactions

Source: entries/2026/05/29/two-phase-commit-test_2pc.md

Example

def commit(self, tx_id):
    for op in operations:
        self.locks.pop(op["key"], None)  # release on commit
def abort(self, tx_id):
    if self.locks.get(op["key"]) == tx_id:
        del self.locks[op["key"]]  # release on abort

JSON