mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
Don't ACK the master after every command.
Sending an ACK is now moved into the replicationSendAck() function.
This commit is contained in:
parent
dd0adbb777
commit
efd87031d0
@ -1868,15 +1868,6 @@ int processCommand(redisClient *c) {
|
|||||||
call(c,REDIS_CALL_FULL);
|
call(c,REDIS_CALL_FULL);
|
||||||
if (listLength(server.ready_keys))
|
if (listLength(server.ready_keys))
|
||||||
handleClientsBlockedOnLists();
|
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;
|
return REDIS_OK;
|
||||||
}
|
}
|
||||||
|
@ -1302,6 +1302,22 @@ void slaveofCommand(redisClient *c) {
|
|||||||
addReply(c,shared.ok);
|
addReply(c,shared.ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Send a REPLCONF ACK command to the master to inform it about the current
|
||||||
|
* processed offset. If we are not connected with a master, the command has
|
||||||
|
* no effects. */
|
||||||
|
void replicationSendAck(void) {
|
||||||
|
redisClient *c = server.master;
|
||||||
|
|
||||||
|
if (c != NULL) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------------------- MASTER CACHING FOR PSYNC -------------------------- */
|
/* ---------------------- MASTER CACHING FOR PSYNC -------------------------- */
|
||||||
|
|
||||||
/* In order to implement partial synchronization we need to be able to cache
|
/* In order to implement partial synchronization we need to be able to cache
|
||||||
@ -1390,6 +1406,7 @@ void replicationResurrectCachedMaster(int newfd) {
|
|||||||
|
|
||||||
/* --------------------------- REPLICATION CRON ---------------------------- */
|
/* --------------------------- REPLICATION CRON ---------------------------- */
|
||||||
|
|
||||||
|
/* Replication cron funciton, called 1 time per second. */
|
||||||
void replicationCron(void) {
|
void replicationCron(void) {
|
||||||
/* Non blocking connection timeout? */
|
/* Non blocking connection timeout? */
|
||||||
if (server.masterhost &&
|
if (server.masterhost &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user