Check whether to switch to fail when setting the node to pfail in cron ()

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 <binloveplay1314@qq.com>
This commit is contained in:
Binbin 2025-01-06 09:26:17 +08:00 committed by GitHub
parent 33b824137e
commit c0014ef15e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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);