Skip to content

Commit b1337b1

Browse files
committed
Diskless replication: Various fixes to backgroundSaveDoneHandlerSocket()
1 parent 4b16263 commit b1337b1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/rdb.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,11 +1299,11 @@ void backgroundSaveDoneHandlerSocket(int exitcode, int bysignal) {
12991299
* can continue to be emtpy, so that it's just a speical case of the
13001300
* normal code path. */
13011301
ok_slaves = zmalloc(sizeof(uint64_t)); /* Make space for the count. */
1302-
ok_slaves = 0;
1302+
ok_slaves[0] = 0;
13031303
if (!bysignal && exitcode == 0) {
13041304
int readlen = sizeof(uint64_t);
13051305

1306-
if (read(server.rdb_pipe_read_result_from_child, ok_slaves, readlen) !=
1306+
if (read(server.rdb_pipe_read_result_from_child, ok_slaves, readlen) ==
13071307
readlen)
13081308
{
13091309
readlen = ok_slaves[0]*sizeof(uint64_t);
@@ -1335,14 +1335,18 @@ void backgroundSaveDoneHandlerSocket(int exitcode, int bysignal) {
13351335
if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_END) {
13361336
uint64_t j;
13371337

1338-
for (j = 1; j < ok_slaves[0]; j++) {
1339-
if (slave->id == ok_slaves[j]) break; /* Found in the OK list. */
1338+
for (j = 0; j < ok_slaves[0]; j++) {
1339+
if (slave->id == ok_slaves[j+1]) break; /* Found in OK list. */
13401340
}
13411341
if (j == ok_slaves[0]) {
13421342
redisLog(REDIS_WARNING,
13431343
"Closing slave %llu: child->slave RDB transfer failed.",
13441344
slave->id);
13451345
freeClient(slave);
1346+
} else {
1347+
redisLog(REDIS_WARNING,
1348+
"Slave %llu correctly received the streamed RDB file.",
1349+
slave->id);
13461350
}
13471351
}
13481352
}

0 commit comments

Comments
 (0)