Replication: send REPLCONF ACK to master.

This commit is contained in:
antirez
2013-05-25 00:54:00 +02:00
parent 1e77b77de4
commit 146f1d7d86
3 changed files with 15 additions and 3 deletions

View File

@ -1798,6 +1798,15 @@ int processCommand(redisClient *c) {
call(c,REDIS_CALL_FULL);
if (listLength(server.ready_keys))
handleClientsBlockedOnLists();
/* Acknowledge the master about the execution of this command. */
if (c->flags & REDIS_MASTER) {
c->flags |= REDIS_MASTER_FORCE_REPLY;
addReplyMultiBulkLen(c,3);
addReplyBulkCString(c,"REPLCONF");
addReplyBulkCString(c,"ACK");
addReplyBulkLongLong(c,c->reploff);
c->flags &= ~REDIS_MASTER_FORCE_REPLY;
}
}
return REDIS_OK;
}
@ -2264,8 +2273,9 @@ sds genRedisInfoString(char *section) {
break;
}
if (state == NULL) continue;
info = sdscatprintf(info,"slave%d:%s,%d,%s\r\n",
slaveid,ip,slave->slave_listening_port,state);
info = sdscatprintf(info,"slave%d:%s,%d,%s,%lld\r\n",
slaveid,ip,slave->slave_listening_port,state,
slave->repl_ack_off);
slaveid++;
}
}