Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -5975,12 +5975,13 @@ int checkClientOutputBufferLimits(client *c) {
* This doesn't have memory consumption implications since the replica client
* will share the backlog buffers memory. */
size_t hard_limit_bytes = server.client_obuf_limits[class].hard_limit_bytes;
size_t soft_limit_bytes = server.client_obuf_limits[class].soft_limit_bytes;
if (class == CLIENT_TYPE_REPLICA && hard_limit_bytes && (long long)hard_limit_bytes < server.repl_backlog_size)
hard_limit_bytes = server.repl_backlog_size;
if (class == CLIENT_TYPE_REPLICA && soft_limit_bytes && (long long)soft_limit_bytes < server.repl_backlog_size)
soft_limit_bytes = server.repl_backlog_size;
if (server.client_obuf_limits[class].hard_limit_bytes && used_mem >= hard_limit_bytes) hard = 1;
if (server.client_obuf_limits[class].soft_limit_bytes &&
used_mem >= server.client_obuf_limits[class].soft_limit_bytes)
soft = 1;
if (server.client_obuf_limits[class].soft_limit_bytes && used_mem >= soft_limit_bytes) soft = 1;

/* We need to check if the soft limit is reached continuously for the
* specified amount of seconds. */
Expand Down
10 changes: 10 additions & 0 deletions tests/integration/replication-buffer.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,16 @@ test "Partial resynchronization is successful even client-output-buffer-limit is
}
assert_equal [s sync_full] {1}
assert_equal [s sync_partial_ok] $psync_count
verify_no_log_message 0 "*closed for overcoming of output buffer limits*" 0

# Take this opportunity to test the soft limit, we won't encounter the COB limit.
set loglines [count_log_lines 0]
r config set client-output-buffer-limit "replica 0 512k 0"
pause_process [srv -1 pid]
r set key $big_str
after 1100
resume_process [srv -1 pid]
verify_no_log_message 0 "*closed for overcoming of output buffer limits*" $loglines
}
}
}
Expand Down
Loading