Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
3d448bda
Commit
3d448bda
authored
Mar 13, 2013
by
antirez
Browse files
Cluster: call clusterHandleSlaveFailover() when our master is down.
parent
ae94fe7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
3d448bda
...
...
@@ -1242,6 +1242,22 @@ void clusterPropagatePublish(robj *channel, robj *message) {
clusterSendPublish
(
NULL
,
channel
,
message
);
}
/* -----------------------------------------------------------------------------
* SLAVE node specific functions
* -------------------------------------------------------------------------- */
/* This function is called if we are a slave node and our master serving
* a non-zero amount of hash slots is in PFAIL state.
*
* The gaol of this function is:
* 1) To check if we are able to perform a failover, is our data updated?
* 2) Ask reachable masters the authorization to perform the failover.
* 3) Check if there is the majority of masters agreeing we should failover.
* 4) Perform the failover informing all the other nodes.
*/
void
clusterHandleSlaveFailover
(
void
)
{
}
/* -----------------------------------------------------------------------------
* CLUSTER cron job
* -------------------------------------------------------------------------- */
...
...
@@ -1377,6 +1393,16 @@ void clusterCron(void) {
server
.
cluster
->
myself
->
slaveof
->
port
);
}
/* If we are a slave and our master is down, but is serving slots,
* call the function that handles the failover. */
if
(
server
.
cluster
->
myself
->
flags
&
REDIS_NODE_SLAVE
&&
server
.
cluster
->
myself
->
slaveof
&&
server
.
cluster
->
myself
->
slaveof
->
flags
&
REDIS_NODE_FAIL
&&
server
.
cluster
->
myself
->
slaveof
->
numslots
!=
0
)
{
clusterHandleSlaveFailover
();
}
if
(
update_state
)
clusterUpdateState
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment