diff options
author | antirez <antirez@gmail.com> | 2020-03-24 11:02:40 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2020-03-25 15:26:37 +0100 |
commit | 57fa355e56540a6fab61a5b8ecdda96225815632 (patch) | |
tree | 223ee35175d615f9dff7a7fef588d47ad96f5502 /src/server.h | |
parent | f15042dbf0f0981c827126cf70bf335e755253f0 (diff) | |
download | redis-57fa355e56540a6fab61a5b8ecdda96225815632.tar.gz |
PSYNC2: meaningful offset implemented.
A very commonly signaled operational problem with Redis master-replicas
sets is that, once the master becomes unavailable for some reason,
especially because of network problems, many times it wont be able to
perform a partial resynchronization with the new master, once it rejoins
the partition, for the following reason:
1. The master becomes isolated, however it keeps sending PINGs to the
replicas. Such PINGs will never be received since the link connection is
actually already severed.
2. On the other side, one of the replicas will turn into the new master,
setting its secondary replication ID offset to the one of the last
command received from the old master: this offset will not include the
PINGs sent by the master once the link was already disconnected.
3. When the master rejoins the partion and is turned into a replica, its
offset will be too advanced because of the PINGs, so a PSYNC will fail,
and a full synchronization will be required.
Related to issue #7002 and other discussion we had in the past around
this problem.
Diffstat (limited to 'src/server.h')
-rw-r--r-- | src/server.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/server.h b/src/server.h index ed4707d66..818fbc3b3 100644 --- a/src/server.h +++ b/src/server.h @@ -1241,6 +1241,7 @@ struct redisServer { char replid[CONFIG_RUN_ID_SIZE+1]; /* My current replication ID. */ char replid2[CONFIG_RUN_ID_SIZE+1]; /* replid inherited from master*/ long long master_repl_offset; /* My current replication offset */ + long long master_repl_meaningful_offset; /* Offset minus latest PINGs. */ long long second_replid_offset; /* Accept offsets up to this for replid2. */ int slaveseldb; /* Last SELECTed DB in replication output */ int repl_ping_slave_period; /* Master pings the slave every N seconds */ |