summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>2020-05-25 11:17:51 +0800
committerantirez <antirez@gmail.com>2020-05-27 12:08:32 +0200
commit2eb2f3635fd6c3cc382f0ab66d80abdc8d69d01e (patch)
tree28e7cef7a0b59aaca56980e839c0782fe6b47961
parent8dd017368b54b53a5e5140591878c031b1abe933 (diff)
downloadredis-2eb2f3635fd6c3cc382f0ab66d80abdc8d69d01e.tar.gz
Revert "PSYNC2: second_replid_offset should be real meaningful offset"
This reverts commit eec769be59d2100748bbb45a0e97e7834f490d4a.
-rw-r--r--src/replication.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/replication.c b/src/replication.c
index 4e734fa51..a41497c08 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -2541,14 +2541,14 @@ void replicationUnsetMaster(void) {
sdsfree(server.masterhost);
server.masterhost = NULL;
- if (server.master) freeClient(server.master);
- replicationDiscardCachedMaster();
- cancelReplicationHandshake();
/* When a slave is turned into a master, the current replication ID
* (that was inherited from the master at synchronization time) is
* used as secondary ID up to the current offset, and a new replication
* ID is created to continue with a new replication history. */
shiftReplicationId();
+ if (server.master) freeClient(server.master);
+ replicationDiscardCachedMaster();
+ cancelReplicationHandshake();
/* Disconnecting all the slaves is required: we need to inform slaves
* of the replication ID change (see shiftReplicationId() call). However
* the slaves will be able to partially resync with us, so it will be