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
f55ad303
Commit
f55ad303
authored
Nov 21, 2013
by
antirez
Browse files
Sentinel: manual failover works again.
parent
297de1ab
Changes
1
Show whitespace changes
Inline
Side-by-side
src/sentinel.c
View file @
f55ad303
...
@@ -2452,6 +2452,8 @@ void sentinelCommand(redisClient *c) {
...
@@ -2452,6 +2452,8 @@ void sentinelCommand(redisClient *c) {
addReplySds(c,sdsnew("-NOGOODSLAVE No suitable slave to promote\r\n"));
addReplySds(c,sdsnew("-NOGOODSLAVE No suitable slave to promote\r\n"));
return;
return;
}
}
redisLog(REDIS_WARNING,"Executing user requested FAILOVER of '%s'",
ri->name);
sentinelStartFailover(ri);
sentinelStartFailover(ri);
ri->flags |= SRI_FORCE_FAILOVER;
ri->flags |= SRI_FORCE_FAILOVER;
addReply(c,shared.ok);
addReply(c,shared.ok);
...
@@ -3017,8 +3019,9 @@ void sentinelFailoverWaitStart(sentinelRedisInstance *ri) {
...
@@ -3017,8 +3019,9 @@ void sentinelFailoverWaitStart(sentinelRedisInstance *ri) {
isleader = leader && strcasecmp(leader,server.runid) == 0;
isleader = leader && strcasecmp(leader,server.runid) == 0;
sdsfree(leader);
sdsfree(leader);
/* If I'm not the leader, I can't continue with the failover. */
/* If I'm not the leader, and it is not a forced failover via
if (!isleader) {
* SENTINEL FAILOVER, then I can't continue with the failover. */
if (!isleader && !(ri->flags & SRI_FORCE_FAILOVER)) {
int election_timeout = SENTINEL_ELECTION_TIMEOUT;
int election_timeout = SENTINEL_ELECTION_TIMEOUT;
/* The election timeout is the MIN between SENTINEL_ELECTION_TIMEOUT
/* The election timeout is the MIN between SENTINEL_ELECTION_TIMEOUT
...
...
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