Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
e57067b6
Commit
e57067b6
authored
Aug 31, 2019
by
antirez
Browse files
More strict checks and better comments in flushSlaveOutputBuffers().
Related to #6296.
parent
2303ba14
Changes
1
Show whitespace changes
Inline
Side-by-side
src/networking.c
View file @
e57067b6
...
@@ -2468,15 +2468,26 @@ void flushSlavesOutputBuffers(void) {
...
@@ -2468,15 +2468,26 @@ void flushSlavesOutputBuffers(void) {
listRewind
(
server
.
slaves
,
&
li
);
listRewind
(
server
.
slaves
,
&
li
);
while
((
ln
=
listNext
(
&
li
)))
{
while
((
ln
=
listNext
(
&
li
)))
{
client
*
slave
=
listNodeValue
(
ln
);
client
*
slave
=
listNodeValue
(
ln
);
int
events
=
aeGetFileEvents
(
server
.
el
,
slave
->
fd
);
int
can_receive_writes
=
(
events
&
AE_WRITABLE
)
||
(
slave
->
flags
&
CLIENT_PENDING_WRITE
);
/* Note that the following will not flush output buffers of slaves
/* We don't want to send the pending data to the replica in a few
* in STATE_ONLINE but having put_online_on_ack set to true: in this
* cases:
* case the writable event is never installed, since the purpose
*
* of put_online_on_ack is to postpone the moment it is installed.
* 1. For some reason there is neither the write handler installed
* This is what we want since slaves in this state should not receive
* nor the client is flagged as to have pending writes: for some
* writes before the first ACK (to know the reason, grep for this
* reason this replica may not be set to receive data. This is
* flag in this file). */
* just for the sake of defensive programming.
*
* 2. The put_online_on_ack flag is true. To know why we don't want
* to send data to the replica in this case, please grep for the
* flag for this flag.
*
* 3. Obviously if the slave is not ONLINE.
*/
if
(
slave
->
replstate
==
SLAVE_STATE_ONLINE
&&
if
(
slave
->
replstate
==
SLAVE_STATE_ONLINE
&&
can_receive_writes
&&
!
slave
->
repl_put_online_on_ack
&&
!
slave
->
repl_put_online_on_ack
&&
clientHasPendingReplies
(
slave
))
clientHasPendingReplies
(
slave
))
{
{
...
...
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