Allow master to replicate command longer than replica's query buffer limit (#9340)

Replication client no longer checks incoming command length against the client-query-buffer-limit. This makes the master able to replicate commands longer than replica's configured client-query-buffer-limit
This commit is contained in:
Qu Chen 2021-08-08 17:34:11 -07:00 committed by GitHub
parent 3307958bd0
commit e8eeba7bee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -2196,7 +2196,7 @@ void readQueryFromClient(connection *conn) {
c->lastinteraction = server.unixtime;
if (c->flags & CLIENT_MASTER) c->read_reploff += nread;
atomicIncr(server.stat_net_input_bytes, nread);
if (sdslen(c->querybuf) > server.client_max_querybuf_len) {
if (!(c->flags & CLIENT_MASTER) && sdslen(c->querybuf) > server.client_max_querybuf_len) {
sds ci = catClientInfoString(sdsempty(),c), bytes = sdsempty();
bytes = sdscatrepr(bytes,c->querybuf,64);

View File

@ -31,6 +31,19 @@ start_server {tags {"repl external:skip"}} {
assert_equal [r debug digest] [r -1 debug digest]
}
test {Master can replicate command longer than client-query-buffer-limit on replica} {
# Configure the master to have a bigger query buffer limit
r config set client-query-buffer-limit 2000000
r -1 config set client-query-buffer-limit 1048576
# Write a very large command onto the master
r set key [string repeat "x" 1100000]
wait_for_condition 300 100 {
[r -1 get key] eq [string repeat "x" 1100000]
} else {
fail "Unable to replicate command longer than client-query-buffer-limit"
}
}
test {Slave is able to evict keys created in writable slaves} {
r -1 select 5
assert {[r -1 dbsize] == 0}