diff options
author | oranagra <oran@redislabs.com> | 2017-02-23 03:17:18 -0800 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2017-12-11 11:09:33 +0100 |
commit | 0f26125841b13c29d89a2b78957262f164b31770 (patch) | |
tree | f8a376bf4c7511f779d0afa465edb820e79eb999 /src/replication.c | |
parent | d9363b6b3b9fb774f94582247b8833cdc05dca5b (diff) | |
download | redis-0f26125841b13c29d89a2b78957262f164b31770.tar.gz |
several bugfixes to diskless replication and the CAPA mechanism
in diskless replication - master not notifing the slave that rdb transfer
terminated on error, and lets slave wait for replication timeout
when starting a replication for a certain mincapa, we must take care to
exclude slaves that didn't declare that capa, otherwise they may get something
that they can't handle
Diffstat (limited to 'src/replication.c')
-rw-r--r-- | src/replication.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/replication.c b/src/replication.c index 064d2bece..328382570 100644 --- a/src/replication.c +++ b/src/replication.c @@ -575,7 +575,7 @@ int startBgsaveForReplication(int mincapa) { * otherwise slave will miss repl-stream-db. */ if (rsiptr) { if (socket_target) - retval = rdbSaveToSlavesSockets(rsiptr); + retval = rdbSaveToSlavesSockets(mincapa, rsiptr); else retval = rdbSaveBackground(server.rdb_filename,rsiptr); } else { @@ -593,6 +593,7 @@ int startBgsaveForReplication(int mincapa) { client *slave = ln->value; if (slave->replstate == SLAVE_STATE_WAIT_BGSAVE_START) { + slave->replstate = REPL_STATE_NONE; slave->flags &= ~CLIENT_SLAVE; listDelNode(server.slaves,ln); addReplyError(slave, @@ -611,8 +612,11 @@ int startBgsaveForReplication(int mincapa) { client *slave = ln->value; if (slave->replstate == SLAVE_STATE_WAIT_BGSAVE_START) { - replicationSetupSlaveForFullResync(slave, - getPsyncInitialOffset()); + /* Check slave has at least the minimum capabilities */ + if ((mincapa & slave->slave_capa) != mincapa) + continue; + replicationSetupSlaveForFullResync(slave, + getPsyncInitialOffset()); } } } |