mirror of https://mirror.osredm.com/root/redis.git
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:
parent
3307958bd0
commit
e8eeba7bee
|
@ -2196,7 +2196,7 @@ void readQueryFromClient(connection *conn) {
|
||||||
c->lastinteraction = server.unixtime;
|
c->lastinteraction = server.unixtime;
|
||||||
if (c->flags & CLIENT_MASTER) c->read_reploff += nread;
|
if (c->flags & CLIENT_MASTER) c->read_reploff += nread;
|
||||||
atomicIncr(server.stat_net_input_bytes, 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();
|
sds ci = catClientInfoString(sdsempty(),c), bytes = sdsempty();
|
||||||
|
|
||||||
bytes = sdscatrepr(bytes,c->querybuf,64);
|
bytes = sdscatrepr(bytes,c->querybuf,64);
|
||||||
|
|
|
@ -31,6 +31,19 @@ start_server {tags {"repl external:skip"}} {
|
||||||
assert_equal [r debug digest] [r -1 debug digest]
|
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} {
|
test {Slave is able to evict keys created in writable slaves} {
|
||||||
r -1 select 5
|
r -1 select 5
|
||||||
assert {[r -1 dbsize] == 0}
|
assert {[r -1 dbsize] == 0}
|
||||||
|
|
Loading…
Reference in New Issue