Skip to content

Commit

Permalink
Deflake Replication backlog memory will become smaller if disconnecting
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
naglera committed Jun 10, 2024
1 parent 72fe6e3 commit 0fa3260
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/integration/replication-buffer.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
}
Expand Down

0 comments on commit 0fa3260

Please sign in to comment.