From c0014ef15e2b09ce6aaf2184aacd20a041e19018 Mon Sep 17 00:00:00 2001 From: Binbin Date: Mon, 6 Jan 2025 09:26:17 +0800 Subject: [PATCH] Check whether to switch to fail when setting the node to pfail in cron (#1061) This may speed up the transition to the fail state a bit. Previously we would only check when we received a pfail/fail report from others in gossip. If myself is the last vote, we can directly switch to fail in here without waiting for the next gossip packet. Signed-off-by: Binbin --- src/cluster_legacy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cluster_legacy.c b/src/cluster_legacy.c index 807488b57d..b59c30126a 100644 --- a/src/cluster_legacy.c +++ b/src/cluster_legacy.c @@ -5217,7 +5217,7 @@ void clusterCron(void) { if (!(node->flags & (CLUSTER_NODE_PFAIL | CLUSTER_NODE_FAIL))) { node->flags |= CLUSTER_NODE_PFAIL; update_state = 1; - if (server.cluster->size == 1 && clusterNodeIsVotingPrimary(myself)) { + if (clusterNodeIsVotingPrimary(myself)) { markNodeAsFailingIfNeeded(node); } else { serverLog(LL_NOTICE, "NODE %.40s (%s) possibly failing.", node->name, node->human_nodename);