summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-10-17 10:43:56 +0200
committerantirez <antirez@gmail.com>2014-10-17 10:43:56 +0200
commitb1337b15b6b090315d884d7372eea344926ae95b (patch)
tree3f58f49008003b2ba2374604befc79a1931fc89d
parent4b16263bd9e7b647ecc3d864481eff3de913a229 (diff)
downloadredis-b1337b15b6b090315d884d7372eea344926ae95b.tar.gz
Diskless replication: Various fixes to backgroundSaveDoneHandlerSocket()
-rw-r--r--src/rdb.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rdb.c b/src/rdb.c
index bcabd0aed..45beae14d 100644
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -1299,11 +1299,11 @@ void backgroundSaveDoneHandlerSocket(int exitcode, int bysignal) {
* can continue to be emtpy, so that it's just a speical case of the
* normal code path. */
ok_slaves = zmalloc(sizeof(uint64_t)); /* Make space for the count. */
- ok_slaves = 0;
+ ok_slaves[0] = 0;
if (!bysignal && exitcode == 0) {
int readlen = sizeof(uint64_t);
- if (read(server.rdb_pipe_read_result_from_child, ok_slaves, readlen) !=
+ if (read(server.rdb_pipe_read_result_from_child, ok_slaves, readlen) ==
readlen)
{
readlen = ok_slaves[0]*sizeof(uint64_t);
@@ -1335,14 +1335,18 @@ void backgroundSaveDoneHandlerSocket(int exitcode, int bysignal) {
if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_END) {
uint64_t j;
- for (j = 1; j < ok_slaves[0]; j++) {
- if (slave->id == ok_slaves[j]) break; /* Found in the OK list. */
+ for (j = 0; j < ok_slaves[0]; j++) {
+ if (slave->id == ok_slaves[j+1]) break; /* Found in OK list. */
}
if (j == ok_slaves[0]) {
redisLog(REDIS_WARNING,
"Closing slave %llu: child->slave RDB transfer failed.",
slave->id);
freeClient(slave);
+ } else {
+ redisLog(REDIS_WARNING,
+ "Slave %llu correctly received the streamed RDB file.",
+ slave->id);
}
}
}