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
0292c5f7
Commit
0292c5f7
authored
May 25, 2013
by
antirez
Browse files
Replication: send REPLCONF ACK to master.
parent
6b4635f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
0292c5f7
...
...
@@ -127,7 +127,8 @@ redisClient *createClient(int fd) {
* data should be appended to the output buffers. */
int
prepareClientToWrite
(
redisClient
*
c
)
{
if
(
c
->
flags
&
REDIS_LUA_CLIENT
)
return
REDIS_OK
;
if
(
c
->
flags
&
REDIS_MASTER
)
return
REDIS_ERR
;
if
((
c
->
flags
&
REDIS_MASTER
)
&&
!
(
c
->
flags
&
REDIS_MASTER_FORCE_REPLY
))
return
REDIS_ERR
;
if
(
c
->
fd
<=
0
)
return
REDIS_ERR
;
/* Fake client */
if
(
c
->
bufpos
==
0
&&
listLength
(
c
->
reply
)
==
0
&&
(
c
->
replstate
==
REDIS_REPL_NONE
||
...
...
src/redis.c
View file @
0292c5f7
...
...
@@ -1868,6 +1868,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
;
}
...
...
@@ -2337,8 +2346,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
++
;
}
}
...
...
src/redis.h
View file @
0292c5f7
...
...
@@ -213,6 +213,7 @@
#define REDIS_CLOSE_ASAP (1<<10)
/* Close this client ASAP */
#define REDIS_UNIX_SOCKET (1<<11)
/* Client connected via Unix domain socket */
#define REDIS_DIRTY_EXEC (1<<12)
/* EXEC will fail for errors while queueing */
#define REDIS_MASTER_FORCE_REPLY (1<<13)
/* Queue replies even if is master */
/* Client request types */
#define REDIS_REQ_INLINE 1
...
...
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