In disaggregated storage, the application decides which node owns shared writes and coordinates elections, replication, and the handoff between nodes. WiredTiger provides leader and follower roles so the application can choose which node persists data to shared storage without restarting the connections.
This page describes roles from the application's perspective, including configuration, expected call sequences, and restrictions. See Disaggregated Storage Roles and Role Changes for their architecture and implementation.
There are two roles: the leader and the follower.
The leader accepts application writes and persists their changes in shared storage through checkpoints. A follower accepts replicated writes and stores their changes locally, without persisting them to shared storage. Both serve reads from shared data: a leader reads the current data, while a follower reads the most recent checkpoint it adopted, together with newer replicated changes it applied locally.
| Responsibility | Leader | Follower |
|---|---|---|
| Accepted writes | Application writes | Writes replicated from the leader |
| Where changes are persisted | Shared storage through checkpoints | Not persisted to shared storage by this node |
| Readable data | Current data | Shared checkpointed data and newer local changes |
| Shared checkpoints | Produces them | Adopts checkpoints produced by the leader |
Once an adopted checkpoint contains a change, the follower can remove its local copy when it is no longer needed by readers. Frequent leader checkpoints and follower checkpoint adoption therefore reduce the amount of data followers must retain locally. A local copy is not removed merely because a checkpoint was produced; the follower must first adopt it, and removal must be safe for existing readers.
Keeping changes locally does not persist them to shared storage. Applications remain responsible for replication and for replaying changes needed after a restart.
The application changes a node's role using WT_CONNECTION::reconfigure with disaggregated=(role=...). There are two role changes: step-up changes a follower into a leader, and step-down changes a leader into a follower. Reconfiguration performs the local storage-engine transition, not the election or replication of changes to another node. The application must prevent competing shared writers and satisfy the transaction and checkpoint requirements of each role change.
Moving shared-write responsibility from one node to another combines a step-down on the old leader with a step-up on the new one. The last shared checkpoint the old leader takes before stepping down is the concluding checkpoint; it is the base from which the new leader continues. A complete handoff usually proceeds as follows:
disaggregated=(checkpoint_meta=...).Step 4 applies whether or not schema epochs are used: schema epochs select which schema operations a checkpoint includes, but do not replace replication. The application must make the corresponding schema available before applying data writes that depend on it.
The diagram shows one asynchronous handoff in which the next leader adopts the checkpoint while still a follower, before the old leader completes its step-down. The example omits schema epochs; their additional settings are described in Schema operations during step-down.
Step-up is initiated by calling WT_CONNECTION::reconfigure with disaggregated=(role=leader) on a follower. After the call completes, the node can accept leader writes and produce shared checkpoints for the disaggregated database.
Transactions and positioned cursors must not span step-up. The application must finish transactions and reset or close positioned cursors before the step-up reconfiguration.
The usual flow of step-up is:
disaggregated=(role=leader).Step-down changes a leader into a follower by calling WT_CONNECTION::reconfigure with disaggregated=(role=follower). The node stops persisting shared writes and instead stores replicated changes locally while continuing to read shared checkpointed data.
Every change the node accepted as leader must end up either in the concluding checkpoint or in a local copy that survives the reconfiguration. The application chooses between two ways of drawing that boundary: blocking step-down stops writes while the concluding checkpoint is taken, while asynchronous step-down declares the boundary in advance so writes can continue during the checkpoint.
The simplest approach, once the application decides to step down, is to take a concluding checkpoint and then call WT_CONNECTION::reconfigure with disaggregated=(role=follower). This approach cannot accept writes that will not be included in the concluding checkpoint, so the application must stop serving writes while taking that checkpoint and reconfiguring the connection.
disaggregated=(role=follower), keeping writes stopped through the call.Asynchronous step-down is initiated by calling WT_CONNECTION::set_timestamp with step_down_timestamp=N on a leader. N defines the concluding checkpoint's boundary: changes committed at or below N are included, while later writes are retained locally. Reads, writes, and schema operations can continue while the checkpoint is taken and handed to the next leader. Writes must still stop for the step-down reconfiguration itself, so asynchronous step-down shortens the period of write unavailability compared with blocking step-down, but does not eliminate it.
The application must meet the following requirements and the timestamp API contract described in WT_CONNECTION::set_timestamp:
The usual flow of asynchronous step-down is:
stable_timestamp to N once every commit at or below N has completed, and call WT_SESSION::checkpoint. WiredTiger rolls back write transactions that began before N was set, so the only such commits are those already in progress when N was set.disaggregated=(role=follower) to switch WiredTiger to follower operations.Some transactions that overlap an asynchronous step-down receive WT_ROLLBACK:
See Error handling for rollback handling.
Data timestamps and schema epochs describe different boundaries: one selects record versions, while the other selects schema operations included in shared metadata. Creating or dropping a table locally does not publish the change to other nodes. The application replicates schema operations, and shared checkpoints contain the corresponding metadata. With schema epochs, WT_SESSION::publish assigns epochs to pending schema operations for a table; checkpointing includes published operations through the stable schema epoch.
Without schema epochs, the concluding checkpoint includes the schema operations issued before it starts, with one exception: tables created after the step-down timestamp was set are not included.
When schema epochs are in use with asynchronous step-down, step_down_disaggregated_schema_epoch=E must be provided together with the step-down timestamp N. Before taking the concluding checkpoint, the schema operations required through epoch E must be completed and published, and stable_disaggregated_schema_epoch must advance to E. E must not be older than the existing stable schema epoch. The stable schema epoch must not advance above E during the step-down process and must remain at E through the step-down reconfiguration.
With blocking step-down, no step-down epoch is set. The concluding checkpoint includes published operations through the stable schema epoch, so the application advances that epoch to cover the schema operations being handed off before taking the checkpoint.