mirror of
https://github.com/fluencelabs/redis
synced 2025-06-12 16:51:22 +00:00
REPLCONF ACK command.
This special command is used by the slave to inform the master the amount of replication stream it currently consumed. it does not return anything so that we not need to consume additional bandwidth needed by the master to reply something. The master can do a number of things knowing the amount of stream processed, such as understanding the "lag" in bytes of the slave, verify if a given command was already processed by the slave, and so forth.
This commit is contained in:
@ -588,6 +588,19 @@ void replconfCommand(redisClient *c) {
|
||||
&port,NULL) != REDIS_OK))
|
||||
return;
|
||||
c->slave_listening_port = port;
|
||||
} else if (!strcasecmp(c->argv[j]->ptr,"ack")) {
|
||||
/* REPLCONF ACK is used by slave to inform the master the amount
|
||||
* of replication stream that it processed so far. It is an
|
||||
* internal only command that normal clients should never use. */
|
||||
long long offset;
|
||||
|
||||
if (!(c->flags & REDIS_SLAVE)) return;
|
||||
if ((getLongLongFromObject(c->argv[j+1], &offset) != REDIS_OK))
|
||||
return;
|
||||
if (offset > c->repl_ack_off)
|
||||
c->repl_ack_off = offset;
|
||||
c->repl_ack_time = server.unixtime;
|
||||
/* Note: this command does not reply anything! */
|
||||
} else {
|
||||
addReplyErrorFormat(c,"Unrecognized REPLCONF option: %s",
|
||||
(char*)c->argv[j]->ptr);
|
||||
|
Reference in New Issue
Block a user