From 11f2c6b115e108202bd9c3c7e94038d4afd029a8 Mon Sep 17 00:00:00 2001 From: chendianqiang Date: Wed, 17 Apr 2019 21:20:10 +0800 Subject: [PATCH 1/4] stop ping when client pause --- src/replication.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/replication.c b/src/replication.c index 9175bb420..237103d90 100644 --- a/src/replication.c +++ b/src/replication.c @@ -2579,7 +2579,7 @@ void replicationCron(void) { /* First, send PING according to ping_slave_period. */ if ((replication_cron_loops % server.repl_ping_slave_period) == 0 && - listLength(server.slaves)) + listLength(server.slaves) && !clientsArePaused()) { ping_argv[0] = createStringObject("PING",4); replicationFeedSlaves(server.slaves, server.slaveseldb, From 4f4676a1420a446e4233c04a80f2009aa819b21f Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 13 May 2019 17:27:06 +0200 Subject: [PATCH 2/4] Fix test false positive introduced by threaded I/O. Now clients that are ready to be terminated asynchronously are processed more often in beforeSleep() instead of being processed in serverCron(). This means that the test will not be able to catch the moment the client was terminated, also note that the 'omem' figure now changes in big steps, because of the new client output buffers layout. So we have to change the test range in order to accomodate for that. Yet the test is useful enough to be worth taking, even if its precision is reduced by this commit. Probably if we get more problems, a thing that makes sense is just to check that the limit is < 200k. That's more than enough actually. --- tests/unit/obuf-limits.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/obuf-limits.tcl b/tests/unit/obuf-limits.tcl index 5d625cf45..c45bf8e86 100644 --- a/tests/unit/obuf-limits.tcl +++ b/tests/unit/obuf-limits.tcl @@ -15,7 +15,7 @@ start_server {tags {"obuf-limits"}} { if {![regexp {omem=([0-9]+)} $c - omem]} break if {$omem > 200000} break } - assert {$omem >= 90000 && $omem < 200000} + assert {$omem >= 70000 && $omem < 200000} $rd1 close } From 9724ca4e22678038c511d312a78df6e8d9d29374 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 13 May 2019 17:30:02 +0200 Subject: [PATCH 3/4] Make comment in getClientOutputBufferMemoryUsage() describing the present. --- src/networking.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/networking.c b/src/networking.c index 6fec97605..4bc22120a 100644 --- a/src/networking.c +++ b/src/networking.c @@ -2295,15 +2295,8 @@ void rewriteClientCommandArgument(client *c, int i, robj *newval) { } } -/* This function returns the number of bytes that Redis is virtually +/* This function returns the number of bytes that Redis is * using to store the reply still not read by the client. - * It is "virtual" since the reply output list may contain objects that - * are shared and are not really using additional memory. - * - * The function returns the total sum of the length of all the objects - * stored in the output list, plus the memory used to allocate every - * list node. The static reply buffer is not taken into account since it - * is allocated anyway. * * Note: this function is very fast so can be called as many time as * the caller wishes. The main usage of this function currently is From 1a1ba483900005dab36e6749b112735593561f30 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 14 May 2019 16:54:59 +0200 Subject: [PATCH 4/4] Test: fix slowlog test false positive. In fast systems "SLOWLOG RESET" is fast enough to don't be logged even when the time limit is "1" sometimes. Leading to false positives such as: [err]: SLOWLOG - can be disabled in tests/unit/slowlog.tcl Expected '1' to be equal to '0' --- tests/unit/slowlog.tcl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/slowlog.tcl b/tests/unit/slowlog.tcl index dbd7a1547..22f088103 100644 --- a/tests/unit/slowlog.tcl +++ b/tests/unit/slowlog.tcl @@ -80,9 +80,11 @@ start_server {tags {"slowlog"} overrides {slowlog-log-slower-than 1000000}} { } test {SLOWLOG - can be disabled} { + r config set slowlog-max-len 1 r config set slowlog-log-slower-than 1 r slowlog reset - assert_equal [r slowlog len] 1 + r debug sleep 0.2 + assert_equal [r slowlog len] 1 r config set slowlog-log-slower-than -1 r slowlog reset r debug sleep 0.2