Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
efd87031
Commit
efd87031
authored
May 27, 2013
by
antirez
Browse files
Don't ACK the master after every command.
Sending an ACK is now moved into the replicationSendAck() function.
parent
dd0adbb7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/redis.c
View file @
efd87031
...
...
@@ -1868,15 +1868,6 @@ 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
;
}
...
...
src/replication.c
View file @
efd87031
...
...
@@ -1302,6 +1302,22 @@ void slaveofCommand(redisClient *c) {
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 -------------------------- */
/* 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 funciton, called 1 time per second. */
void
replicationCron
(
void
)
{
/* Non blocking connection timeout? */
if
(
server
.
masterhost
&&
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment