From 0fa32600da74475aa33a8dc9119e20056eba5fa6 Mon Sep 17 00:00:00 2001 From: naglera Date: Sun, 9 Jun 2024 14:00:37 +0000 Subject: [PATCH] Deflake Replication backlog memory will become smaller if disconnecting with replica fails due to "master didn't disconnect with replica2" Chain of events 1. replica 1 synced 2. replica 2 disconnected 3. replica 2 need fsync 4. rdb connection created 5. replica 2 paused 6. write large key to master 7. replica 2 gets cob overrun 8. replica 2 connection is kept connected although replica is unresponsive. State 8 is healthy as the master has long repl-timeout. It should only throw replica2 psync connection. Signed-off-by: naglera --- tests/integration/replication-buffer.tcl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/integration/replication-buffer.tcl b/tests/integration/replication-buffer.tcl index e11398aa02..27956290bc 100644 --- a/tests/integration/replication-buffer.tcl +++ b/tests/integration/replication-buffer.tcl @@ -187,7 +187,7 @@ start_server {} { assert_equal [$master debug digest] [$replica1 debug digest] } - test {Replication backlog memory will become smaller if disconnecting with replica} { + test "Replication backlog memory will become smaller if disconnecting with replica rdbchannel $rdbchannel" { assert {[s repl_backlog_histlen] > [expr 2*10000*10000]} if {$rdbchannel == "yes"} { # 1 connection of replica1 @@ -204,7 +204,9 @@ start_server {} { # master will close replica2's connection since replica2's output # buffer limit is reached, so there only is replica1. wait_for_condition 100 100 { - [s connected_slaves] eq {1} + [s connected_slaves] eq {1} || + ([s connected_slaves] eq {2} && + [string match {*slave*state=wait_bgsave*type=rdb-conn*} [$master info]]) } else { fail "master didn't disconnect with replica2" }