ARCHIVED from builddistributedsystem.com on 2026-04-28 — URL: https://builddistributedsystem.com/tracks/coordinator/tasks/task-9-5-txn-kv
TASK

Implementation

Transactional KV: begin, read, write, commit/abort. Use 2PC for cross-shard transactions.

Sample Test Cases

Begin transactionTimeout: 5000ms
Input
{"src":"c0","dest":"n1","body":{"type":"init","msg_id":1,"node_id":"n1","node_ids":["n1"]}}
{"src":"c1","dest":"n1","body":{"type":"txn_begin","msg_id":2}}
Expected Output
{"src":"n1","dest":"c0","body":{"type":"init_ok","in_reply_to":1,"msg_id":0}}
{"src":"n1","dest":"c1","body":{"type":"txn_begin_ok","in_reply_to":2,"msg_id":1,"tx_id":"tx1"}}

Hints

Hint 1
Multi-key transactions
Hint 2
Use 2PC for cross-shard
Hint 3
Read-your-writes
OVERVIEW

Theoretical Hub

ACID

Atomic, Consistent, Isolated, Durable. Distributed transactions harder due to network partitions.

Key Concepts

transactionsACIDisolation
main.py
python
Build Transactional Key-Value Store - The Coordinator | Build Distributed Systems