From a633580281b730273d0325496a80e352b99c2ab7 Mon Sep 17 00:00:00 2001 From: Andi Skrgat Date: Tue, 17 Feb 2026 07:18:14 +0100 Subject: [PATCH] feat: Coordinator request forwarding --- .../high-availability/ha-commands-reference.mdx | 15 +++++++-------- .../how-high-availability-works.mdx | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/pages/clustering/high-availability/ha-commands-reference.mdx b/pages/clustering/high-availability/ha-commands-reference.mdx index 84fe3e3c2..36b260895 100644 --- a/pages/clustering/high-availability/ha-commands-reference.mdx +++ b/pages/clustering/high-availability/ha-commands-reference.mdx @@ -14,12 +14,16 @@ Memgraph High Availability (HA) cluster. ## Cluster registration commands -**Important:** **All registration commands (adding coordinators and registering -data instances) must be executed on the *same* coordinator.** You may choose any +**Important:** You may choose any coordinator for the initial setup; it automatically becomes the leader. After setup, the choice no longer matters. + +All queries can be run on any coordinator. If currently the coordinator is not a leader, the query will be automatically forwarded to the current leader and executed there. +This is because Raft protocol specifies that only leader should accept changes in the cluster. + + ### `ADD COORDINATOR` Adds a coordinator to the cluster. @@ -78,7 +82,6 @@ REMOVE COORDINATOR coordinatorId; {

Behavior & implications

} -- Must be executed on the **leader** coordinator. - Leader coordinator **cannot** remove itself. To remove the leader, first trigger a leadership change. @@ -106,7 +109,6 @@ of each instance. {

Behavior & implications

} -- Must be executed on the **leader** coordinator. - Only bolt server can be updated. {

Example

} @@ -294,8 +296,7 @@ SHOW INSTANCE; ### `SHOW REPLICATION LAG` -Shows replication lag (in committed transactions) for all instances. Must be run -on the **leader**. +Shows replication lag (in committed transactions) for all instances. ```cypher SHOW REPLICATION LAG; @@ -326,7 +327,5 @@ FORCE RESET CLUSTER STATE; {

Implications

} -- Must be executed on the **leader** coordinator. - diff --git a/pages/clustering/high-availability/how-high-availability-works.mdx b/pages/clustering/high-availability/how-high-availability-works.mdx index 0e31c61b6..e8cdfacb1 100644 --- a/pages/clustering/high-availability/how-high-availability-works.mdx +++ b/pages/clustering/high-availability/how-high-availability-works.mdx @@ -133,9 +133,20 @@ Below is a cleaned-up categorization. #### Coordinator → Coordinator RPCs -| RPC | Purpose | Description | -| -------------------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -| `ShowInstancesRpc` | Follower requests cluster state from leader | Sent by a follower coordinator to the leader coordinator when a user executes `SHOW INSTANCES` through the follower. | +| RPC | Purpose | Description | +| ------------------------ | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `ShowInstancesRpc` | Follower requests cluster state from leader. | Sent by a follower coordinator to the leader coordinator when a user executes `SHOW INSTANCES` through the follower. | +| `AddCoordinatorRpc` | Follower requests adding coordinator. | Sent by a follower coordinator to the leader coordinator when a user executes `ADD COORDINATOR` through the follower. | +| `RemoveCoordinatorRpc` | Follower requests removing coordinator. | Sent by a follower coordinator to the leader coordinator when a user executes `REMOVE COORDINATOR` through the follower. | +| `RegisterInstanceRpc` | Follower requests registering an instance. | Sent by a follower coordinator to the leader coordinator when a user executes `REGISTER INSTANCE` through the follower. | +| `UnregisterInstanceRpc` | Follower requests unregistering an instance. | Sent by a follower coordinator to the leader coordinator when a user executes `UNREGISTER INSTANCE` through the follower. | +| `SetInstanceToMainRpc` | Follower requests updating main instance. | Sent by a follower coordinator to the leader coordinator when a user executes `SET INSTANCE TO MAIN` through the follower. | +| `DemoteInstanceRpc` | Follower requests demoting and instance. | Sent by a follower coordinator to the leader coordinator when a user executes `DEMOTE INSTANCE` through the follower. | +| `UpdateConfigRpc` | Follower requests updating config. | Sent by a follower coordinator to the leader coordinator when a user executes `UPDATE CONFIG` through the follower. | +| `ForceResetRpc` | Follower requests resetting cluster state. | Sent by a follower coordinator to the leader coordinator when a user executes `FORCE RESET` through the follower. | +| `ShowInstancesRpc` | Follower requests showing cluster state. | Sent by a follower coordinator to the leader coordinator when a user executes `SHOW INSTANCES` through the follower. | +| `GetRoutingTableRpc` | Follower requests a routing table. | Sent by a follower coordinator to the leader coordinator when a user connect using `bolt+routing` through the follower. | +| `CoordReplicationLagRpc` | Follower requests replication lag info. | Sent by a follower coordinator to the leader coordinator when a user executes `SHOW REPLICATION LAG` through the follower. | #### Coordinator → Data Instance RPCs