Dual Channel Replication - Verify Replica Local Buffer Limit Configuration (#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>
This commit is contained in:
Amit Nagler 2024-09-11 03:26:28 +03:00 committed by GitHub
parent 58fe9c0138
commit 1b24168450
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -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);

View File

@ -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