summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2020-05-25 11:37:25 +0200
committerGitHub <noreply@github.com>2020-05-25 11:37:25 +0200
commit9e055a0f1ff5730ac412a1a2c31e75b15401fe2c (patch)
tree4fc41e88d78209ebd0cfc07d63c686a4a792cabb
parentb89e6d74faa27c9edf9d5e867a408b6b5c39b05e (diff)
parenteec769be59d2100748bbb45a0e97e7834f490d4a (diff)
downloadredis-9e055a0f1ff5730ac412a1a2c31e75b15401fe2c.tar.gz
Merge pull request #7320 from soloestoy/second-replid-offset-should-be-meaningful-offset
PSYNC2: second_replid_offset should be real meaningful offset
-rw-r--r--src/replication.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/replication.c b/src/replication.c
index e1c65d48b..d45a15783 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -2531,14 +2531,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