Cluster Bus v2 - Decentralized Failure Detector - #4127
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: Sushil Paneru <sushil.paneru1@gmail.com>
e02768f to
c9d6698
Compare
Signed-off-by: Sushil Paneru <sushil.paneru1@gmail.com>
28bb1b2 to
37c330e
Compare
Signed-off-by: Sushil Paneru <sushil.paneru1@gmail.com>
Signed-off-by: Sushil Paneru <sushil.paneru1@gmail.com>
| 2. **NODE_FAIL for single-node shards**: for shards with no replicas, | ||
| there is no replication stream to monitor. If a peer hasn't | ||
| responded within `cluster-node-timeout`, the leader proposes | ||
| NODE_FAIL. When the node comes back and sends AE_ACK, the leader | ||
| proposes NODE_RECOVER. | ||
|
|
||
| **Whole-shard-down fallback:** When ALL members of a multi-node shard | ||
| have timed out on the leader's AE_ACK tracking, no shard member is |
There was a problem hiding this comment.
nit: Aren't these actually the same thing?
Just when there are no replicas, whole shard = 1 node.
I guess conceptually aligning these two may be useful. So we only have two modes of failure:
- Shard-level Replica <-> Primary detection
- Cluster-level Leader <-> (whole shard) detection
There was a problem hiding this comment.
Yes you are right, will simplify the doc.
| /* Grace period (ms) before proposing NODE_FAIL for a replica that is not in | ||
| * server.replicas. After a topology change (FAILOVER/SET_REPLICA_OF), a | ||
| * healthy replica needs time to establish its replication connection. */ | ||
| #define REPL_CONNECT_GRACE_PERIOD_MS 5000 |
There was a problem hiding this comment.
Maybe max(5000, server.cluster_node_timeout)?
| Mark a node as failed. Proposed by a shard member via the | ||
| replication-stream detector, or by the raft leader via AE_ACK | ||
| for single-node shards and whole-shard-down fallback. The | ||
| proposer field enables apply-time validation (see Failure |
There was a problem hiding this comment.
Did I miss where apply-time validation is in the doc? I see that we describe it in NODE_RECOVER but this points to Failure Detection
There was a problem hiding this comment.
there was dangling reference, updated the doc.
| if (node && node != myself) { | ||
| clusterNode *node = NULL; | ||
| clusterNode *proposer = NULL; | ||
| int valid_proposer = raftValidateFailRecoverEntry(e->data, &node, &proposer); |
There was a problem hiding this comment.
Aren't we subject to this style of failure?
- R proposes FAILOVER
- P proposes NODE_FAIL R
- R is promoted to primary, P is demoted to replica. Shard epoch bumps to E+1
- The stale NODE_FAIL R (proposed by P) is applied next.
- The proposer validator sees P is a replica, and R is a primary. Since replica_and_primary is valid (a replica can fail its primary), it applies the failure, marking the new primary R as failed.
I think it would be trivially provable if we just made NODE_FAIL check (but not bump) on the epoch. If we do that, I don't think we actually need apply-time proposer validation. We could do the proposer validation at proposal time, and let the epoch ensure there is no conflicting changes that would invalidate that proposal time check.
There was a problem hiding this comment.
Good catch. I have added epoch validation in apply time and proposer validation in proposal time. But for NODE_RECOVER I don't think we should do epoch validation. It can cause legitimate recovery to be delayed, causing availability regression on replicas.
Signed-off-by: Sushil Paneru <sushil.paneru1@gmail.com>
c0fd464 to
eede0d7
Compare
Signed-off-by: Sushil Paneru <sushil.paneru1@gmail.com>
Closes #3862
Implements a decentralized failure detection mechanism for multi-node shard that uses the replication stream (data-path) rather than relying solely on the centralized AE_ACK-based detector on the raft leader. For multi-node shard, this provides reliable signal on the actual replication health.
The failure detector uses two complementary mechanisms (either of - Centralized or decentralized):
In case where shard nodes can't reach each other but can be reached by raft leader, replica will get marked NODE_FAIL by the primary as this replica is of no use to primary.
Testing