mirror of
https://github.com/fluencelabs/redis
synced 2025-03-16 15:40:49 +00:00
Cluster: perform orphaned masters check before continue statements.
The check was placed in a way that conflicted with the continue statements used by the node hearth beat code later that needs to skip the current node sometimes. Moved at the start of the function so that's always executed.
This commit is contained in:
parent
c2507b0ff6
commit
6c9359add1
@ -2312,6 +2312,17 @@ void clusterCron(void) {
|
||||
(REDIS_NODE_MYSELF|REDIS_NODE_NOADDR|REDIS_NODE_HANDSHAKE))
|
||||
continue;
|
||||
|
||||
/* Orphaned master check, useful only if the current instance
|
||||
* is a slave that may migrate to another master. */
|
||||
if (nodeIsSlave(myself) && nodeIsMaster(node) && !nodeFailed(node)) {
|
||||
int okslaves = clusterCountNonFailingSlaves(node);
|
||||
|
||||
if (okslaves == 0) orphaned_masters++;
|
||||
if (okslaves > max_slaves) max_slaves = okslaves;
|
||||
if (nodeIsSlave(myself) && myself->slaveof == node)
|
||||
this_slaves = okslaves;
|
||||
}
|
||||
|
||||
/* If we are waiting for the PONG more than half the cluster
|
||||
* timeout, reconnect the link: maybe there is a connection
|
||||
* issue even if the node is alive. */
|
||||
@ -2357,17 +2368,6 @@ void clusterCron(void) {
|
||||
update_state = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Orphaned master check, useful only if the current instance
|
||||
* is a slave that may migrate to another master. */
|
||||
if (nodeIsSlave(myself) && nodeIsMaster(node) && !nodeFailed(node)) {
|
||||
int okslaves = clusterCountNonFailingSlaves(node);
|
||||
|
||||
if (okslaves == 0) orphaned_masters++;
|
||||
if (okslaves > max_slaves) max_slaves = okslaves;
|
||||
if (nodeIsSlave(myself) && myself->slaveof == node)
|
||||
this_slaves = okslaves;
|
||||
}
|
||||
}
|
||||
dictReleaseIterator(di);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user