Transaction Manager: The Architecture

Concept. The transaction manager coordinates concurrency, logging, and recovery.

Intuition. When Mickey buys Premium while Minnie updates her profile and Daffy adds a song, the TM routes each one through the scheduler (interleave for throughput), the lock manager (block them only on rows they share), the WAL (log every change before it touches the data), and, if the server crashes, the recovery manager (replay the log, then undo unfinished transactions). One coherent execution, five cooperating components, ACID preserved.

You assembled these pieces at the close of the Transactions module, in Connecting It All Together. This page is the reference architecture: the whole Transaction Manager in one diagram. The next page runs it: Three Transactions traces a concrete execution. Recovery itself, the two-pass algorithm, you saw in the last section.

The Architecture

Transaction Manager architecture: User Transactions enter the TM (Scheduler, Lock Manager, Write-Ahead Log, Deadlock Detector, Recovery Manager) and a consistent ACID Database State comes out.

Figure 1. Scheduling and locking provide isolation. Logging and recovery support atomicity and durability; deadlock detection breaks cycles of waiting. Application logic and constraints preserve consistency.

Jump to a component: Scheduler · Lock Manager · Write-Ahead Log · Deadlock Detector · Recovery Manager

A No-Conflict Trace

Watch the components run together on a no-conflict trace. Mickey buys Premium, Minnie updates her profile, and Daffy adds a song, all at the same instant. Because the three touch different tuples, the deadlock detector has nothing to do: no transaction waits.

Three transactions on different tuples (Mickey blue, Minnie orange, Daffy violet) flow through the Scheduler, Lock Manager, and Write-Ahead Log; the Deadlock Detector stays grey and idle; the Recovery Manager stands by; the result is one consistent committed state.

Figure 2. One coherent execution. The scheduler routes each transaction to a thread, the lock manager grants all three locks with no waiting (the rows do not overlap), and the WAL logs every change before its commit becomes durable. The deadlock detector stays quiet because there is no waits-for cycle, and the recovery manager only acts if the server crashes. ACID preserved.


Why It Scales

Out of about 1000 concurrent transactions, ~980 touch independent rows (green) and never wait; only 10 to 20 actually conflict (amber). Three design choices keep this cheap: O(1) hash lock checks, a sequential WAL, and separation of concerns. This is an example workload, not a throughput guarantee.

Figure 3. In this example, most transactions access different rows. Actual contention depends on the workload; hash-based lock checks and sequential logging reduce overhead.