Part 2 of 5 · 1 min read
Why a multi-node transaction needs coordination
Each node can decide to commit or abort on its own, but the nodes must all reach the same decision together.
Think of several separate stores in a chain, each asked to apply the same price change. The chain's owner needs every single store to actually apply it, or none of them to. Never should some stores charge the old price while others charge the new one.
In plain words: a distributed transaction is a transaction whose operations span more than one node, requiring all of those nodes to agree on the same outcome, either all committing or all aborting. A single-node transaction's atomicity guarantee, covered in the transactions level, comes from one node managing its own write-ahead log and locks; a distributed transaction needs that same all-or-nothing guarantee to hold across multiple independent nodes, none of which can see the others' internal state directly. Without an explicit coordination protocol, one node could commit its part while another aborts its part, leaving the data permanently inconsistent between them.
A worked example. A transaction transferring funds between an account on node A and an account on node B must either debit A and credit B together, or do neither. If A commits its debit but B aborts its credit, due to some local failure on B, the money simply vanishes.
The key lines. No new SQL; distributed transaction coordination is typically handled by a transaction coordinator or manager sitting above the individual nodes' own SQL engines.
Distributed transaction
A distributed transaction is a transaction whose operations span more than one node, requiring all of those nodes to agree on a single outcome, either committing together or aborting together.
Example: a funds transfer that must debit one node's account and credit another node's account together, never just one of the two, is a distributed transaction.