mirror of https://mirror.osredm.com/root/redis.git
Fix potential infinite loop of RANDOMKEY during client pause (#13863)
CI / test-ubuntu-latest (push) Failing after 31s
Details
CI / build-debian-old (push) Failing after 32s
Details
CI / build-libc-malloc (push) Failing after 31s
Details
CI / build-centos-jemalloc (push) Failing after 31s
Details
CI / build-old-chain-jemalloc (push) Failing after 32s
Details
Codecov / code-coverage (push) Failing after 32s
Details
Spellcheck / Spellcheck (push) Failing after 32s
Details
CI / test-sanitizer-address (push) Failing after 4m35s
Details
CI / build-32bit (push) Failing after 5m35s
Details
CI / build-macos-latest (push) Has been cancelled
Details
CodeQL / Analyze (cpp) (push) Failing after 32s
Details
Coverity Scan / coverity (push) Has been skipped
Details
External Server Tests / test-external-standalone (push) Failing after 31s
Details
External Server Tests / test-external-cluster (push) Failing after 31s
Details
External Server Tests / test-external-nodebug (push) Failing after 6m47s
Details
CI / test-ubuntu-latest (push) Failing after 31s
Details
CI / build-debian-old (push) Failing after 32s
Details
CI / build-libc-malloc (push) Failing after 31s
Details
CI / build-centos-jemalloc (push) Failing after 31s
Details
CI / build-old-chain-jemalloc (push) Failing after 32s
Details
Codecov / code-coverage (push) Failing after 32s
Details
Spellcheck / Spellcheck (push) Failing after 32s
Details
CI / test-sanitizer-address (push) Failing after 4m35s
Details
CI / build-32bit (push) Failing after 5m35s
Details
CI / build-macos-latest (push) Has been cancelled
Details
CodeQL / Analyze (cpp) (push) Failing after 32s
Details
Coverity Scan / coverity (push) Has been skipped
Details
External Server Tests / test-external-standalone (push) Failing after 31s
Details
External Server Tests / test-external-cluster (push) Failing after 31s
Details
External Server Tests / test-external-nodebug (push) Failing after 6m47s
Details
The bug mentioned in this [#13862](https://github.com/redis/redis/issues/13862) has been fixed. --------- Signed-off-by: li-benson <1260437731@qq.com> Signed-off-by: youngmore1024 <youngmore1024@outlook.com> Co-authored-by: youngmore1024 <youngmore1024@outlook.com>
This commit is contained in:
parent
cb02bd190b
commit
427c36888e
2
src/db.c
2
src/db.c
|
@ -446,7 +446,7 @@ robj *dbRandomKey(redisDb *db) {
|
|||
|
||||
key = dictGetKey(de);
|
||||
keyobj = createStringObject(key,sdslen(key));
|
||||
if (allvolatile && server.masterhost && --maxtries == 0) {
|
||||
if (allvolatile && (server.masterhost || isPausedActions(PAUSE_ACTION_EXPIRE)) && --maxtries == 0) {
|
||||
/* If the DB is composed only of keys with an expire set,
|
||||
* it could happen that all the keys are already logically
|
||||
* expired in the slave, so the function cannot stop because
|
||||
|
|
|
@ -359,6 +359,26 @@ start_server {tags {"pause network"}} {
|
|||
} {bar2}
|
||||
}
|
||||
|
||||
test "Test the randomkey command will not cause the server to get into an infinite loop during the client pause write" {
|
||||
r flushall
|
||||
|
||||
r multi
|
||||
r set key value px 3
|
||||
r client pause 10000 write
|
||||
r exec
|
||||
|
||||
after 5
|
||||
|
||||
wait_for_condition 50 100 {
|
||||
[r randomkey] == "key"
|
||||
} else {
|
||||
fail "execute randomkey failed, caused by the infinite loop"
|
||||
}
|
||||
|
||||
r client unpause
|
||||
assert_equal [r randomkey] {}
|
||||
}
|
||||
|
||||
# Make sure we unpause at the end
|
||||
r client unpause
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue