{"id":"2pc-uses-key-level-locking","text":"Participants lock at key granularity during `prepare()`; a second transaction touching a locked key receives a `\"no\"` vote and aborts rather than waiting or queuing","truth_value":"IN","source":"entries/2026/05/29/two-phase-commit-test_2pc.md","source_url":"","source_hash":"","justifications":[],"dependents":[],"metadata":{"example":"self.locks = {}  # key -> tx_id\nfor op in operations:\n    key = op[\"key\"]\n    if key in self.locks and self.locks[key] != tx_id:\n        return {\"vote\": \"no\", \"reason\": f\"key locked by {self.locks[key]}\"}"},"explanation":{"steps":[{"node":"2pc-uses-key-level-locking","truth_value":"IN","reason":"premise"}]}}