mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
clusterState->mf_master_offset init offset change to -1 (#8651)
resolve cluster failover timeout when master repl_offset is 0
This commit is contained in:
parent
6bf81eb7b1
commit
725762c48d
@ -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
|
||||
|
@ -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. */
|
||||
|
Loading…
Reference in New Issue
Block a user