Commit b75ae0bb authored by antirez's avatar antirez
Browse files

PSYNC2: Create backlog on slave partial sync as well.

A slave may be started with an RDB file able to provide enough slave to
perform a successful partial SYNC with its master. However in such a
case, how outlined in issue #4268, the slave backlog will not be
started, since it was only initialized on full syncs attempts. This
creates different problems with successive PSYNC attempts that will
always result in full synchronizations.

Thanks to @fdingiit for discovering the issue.
parent 8885921d
...@@ -1531,6 +1531,11 @@ int slaveTryPartialResynchronization(int fd, int read_reply) { ...@@ -1531,6 +1531,11 @@ int slaveTryPartialResynchronization(int fd, int read_reply) {
/* Setup the replication to continue. */ /* Setup the replication to continue. */
sdsfree(reply); sdsfree(reply);
replicationResurrectCachedMaster(fd); replicationResurrectCachedMaster(fd);
/* If this instance was restarted and we read the metadata to
* PSYNC from the persistence file, our replication backlog could
* be still not initialized. Create it. */
if (server.repl_backlog == NULL) createReplicationBacklog();
return PSYNC_CONTINUE; return PSYNC_CONTINUE;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment