Skip to content

Commit

Permalink
Dual Channel Replication - Verify Replica Local Buffer Limit Configur…
Browse files Browse the repository at this point in the history
…ation (#989)

Prior to comparing the replica buffer against the configured limit, we
need to ensure that the limit configuration is enabled. If the limit is
set to zero, it indicates that there is no limit, and we should skip the
buffer limit check.

---------

Signed-off-by: naglera <anagler123@gmail.com>
  • Loading branch information
naglera authored Sep 11, 2024
1 parent 58fe9c0 commit 1b24168
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -2805,7 +2805,8 @@ void bufferReplData(connection *conn) {
remaining_bytes = readIntoReplDataBlock(conn, tail, remaining_bytes);
}
if (readlen && remaining_bytes == 0) {
if (server.pending_repl_data.len > server.client_obuf_limits[CLIENT_TYPE_REPLICA].hard_limit_bytes) {
if (server.client_obuf_limits[CLIENT_TYPE_REPLICA].hard_limit_bytes &&
server.pending_repl_data.len > server.client_obuf_limits[CLIENT_TYPE_REPLICA].hard_limit_bytes) {
serverLog(LL_NOTICE, "Replication buffer limit reached, stopping buffering.");
/* Stop accumulating primary commands. */
connSetReadHandler(conn, NULL);
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/replication-buffer.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ start_server {} {
# with master.
$master config set repl-timeout 1000
$replica1 config set repl-timeout 1000
$replica1 config set client-output-buffer-limit "replica 1024 0 0"
$replica2 config set repl-timeout 1000
$replica2 config set client-output-buffer-limit "replica 0 0 0"
$replica2 config set client-output-buffer-limit "replica 1024 0 0"
$replica2 config set dual-channel-replication-enabled $dualchannel

$replica1 replicaof $master_host $master_port
Expand Down

0 comments on commit 1b24168

Please sign in to comment.