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
725762c4
Unverified
Commit
725762c4
authored
Mar 23, 2021
by
linyi-xq
Committed by
GitHub
Mar 22, 2021
Browse files
clusterState->mf_master_offset init offset change to -1 (#8651)
resolve cluster failover timeout when master repl_offset is 0
parent
6bf81eb7
Changes
2
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
725762c4
...
...
@@ -1811,7 +1811,7 @@ int clusterProcessPacket(clusterLink *link) {
nodeIsSlave(myself) &&
myself->slaveof == sender &&
hdr->mflags[0] & CLUSTERMSG_FLAG0_PAUSED &&
server.cluster->mf_master_offset ==
0
)
server.cluster->mf_master_offset ==
-1
)
{
server.cluster->mf_master_offset = sender->repl_offset;
clusterDoBeforeSleep(CLUSTER_TODO_HANDLE_MANUALFAILOVER);
...
...
@@ -3419,7 +3419,7 @@ void resetManualFailover(void) {
server.cluster->mf_end = 0; /* No manual failover in progress. */
server.cluster->mf_can_start = 0;
server.cluster->mf_slave = NULL;
server.cluster->mf_master_offset =
0
;
server.cluster->mf_master_offset =
-1
;
}
/* If a manual failover timed out, abort it. */
...
...
@@ -3440,7 +3440,7 @@ void clusterHandleManualFailover(void) {
* next steps are performed by clusterHandleSlaveFailover(). */
if (server.cluster->mf_can_start) return;
if (server.cluster->mf_master_offset ==
0
) return; /* Wait for offset... */
if (server.cluster->mf_master_offset ==
-1
) return; /* Wait for offset... */
if (server.cluster->mf_master_offset == replicationGetSlaveOffset()) {
/* Our replication offset matches the master replication offset
...
...
src/cluster.h
View file @
725762c4
...
...
@@ -168,7 +168,7 @@ typedef struct clusterState {
clusterNode
*
mf_slave
;
/* Slave performing the manual failover. */
/* Manual failover state of slave. */
long
long
mf_master_offset
;
/* Master offset the slave needs to start MF
or
zero
if still not received. */
or
-1
if still not received. */
int
mf_can_start
;
/* If non-zero signal that the manual failover
can start requesting masters vote. */
/* The following fields are used by masters to take state on elections. */
...
...
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