Commit f0b807cd authored by antirez's avatar antirez
Browse files

Cluster: update cluster state on PFAIL flag set/cleared on nodes.

parent 299b8f76
...@@ -1250,7 +1250,7 @@ void clusterPropagatePublish(robj *channel, robj *message) { ...@@ -1250,7 +1250,7 @@ void clusterPropagatePublish(robj *channel, robj *message) {
void clusterCron(void) { void clusterCron(void) {
dictIterator *di; dictIterator *di;
dictEntry *de; dictEntry *de;
int j; int j, update_state = 0;
time_t min_ping_sent = 0; time_t min_ping_sent = 0;
clusterNode *min_ping_node = NULL; clusterNode *min_ping_node = NULL;
...@@ -1348,6 +1348,7 @@ void clusterCron(void) { ...@@ -1348,6 +1348,7 @@ void clusterCron(void) {
* conditions detected by clearNodeFailureIfNeeded(). */ * conditions detected by clearNodeFailureIfNeeded(). */
if (node->flags & REDIS_NODE_PFAIL) { if (node->flags & REDIS_NODE_PFAIL) {
node->flags &= ~REDIS_NODE_PFAIL; node->flags &= ~REDIS_NODE_PFAIL;
update_state = 1;
} else if (node->flags & REDIS_NODE_FAIL) { } else if (node->flags & REDIS_NODE_FAIL) {
clearNodeFailureIfNeeded(node); clearNodeFailureIfNeeded(node);
} }
...@@ -1358,6 +1359,7 @@ void clusterCron(void) { ...@@ -1358,6 +1359,7 @@ void clusterCron(void) {
redisLog(REDIS_DEBUG,"*** NODE %.40s possibly failing", redisLog(REDIS_DEBUG,"*** NODE %.40s possibly failing",
node->name); node->name);
node->flags |= REDIS_NODE_PFAIL; node->flags |= REDIS_NODE_PFAIL;
update_state = 1;
} }
} }
} }
...@@ -1374,6 +1376,8 @@ void clusterCron(void) { ...@@ -1374,6 +1376,8 @@ void clusterCron(void) {
replicationSetMaster(server.cluster->myself->slaveof->ip, replicationSetMaster(server.cluster->myself->slaveof->ip,
server.cluster->myself->slaveof->port); server.cluster->myself->slaveof->port);
} }
if (update_state) clusterUpdateState();
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment