Replica Move Example for MariaDB Xpand


MariaDB Xpand's Rebalancer automatically moves a replicas to a new node to ensure that read and write requests are distributed evenly between nodes.


Information provided here applies to:

  • MariaDB Xpand 5.3

  • MariaDB Xpand 6.0

  • MariaDB Xpand 6.1

Beginning State

Xpand Rebalancer Queue

At the start of this example, replicas of Slice 1 reside on Xpand nodes node3 and node4.

Copy Replica

Xpand Rebalancer Queue

MariaDB Xpand decides to move the non-ranking replica from node4 to node1:

  • A new replica is created on node1

    • The new replica is initially empty

    • The new replica is marked as "building", so that queries do not access it

  • Xpand begins copying data from the non-ranking replica on node4 into the empty replica on node1

  • If the slice receives any writes, the writes are written to a Recovery Queue for the slice on node2

    • Xpand considers the Recovery Queue to be another replica for the slice

Replay Recovery Queue

Xpand Rebalancer Queue

After the replica is copied from node4 to node1, MariaDB Xpand asynchronously replays transactions in the Recovery Queue.

Disable Recovery Queue

Xpand Rebalancer Queue

After the transactions in the Recovery Queue have been replayed, the Recovery Queue is disabled:

  • The Recovery Queue is no longer updated by new transactions

  • The Recovery Queue is still updated by older transactions, and the updates are applied synchronously to the new replica

  • The old replica is retired and the new replica is made available

  • Transactions that started before the update still see the old replica, but the old replica no longer receives new writes

Final State

Xpand Rebalancer Queue

At the end of the operation, MariaDB Xpand removes the old replica and the Recovery Queue.