Fix missing expires_cursor check when existing defrag cycle (#14270)
CI / test-ubuntu-latest (push) Has been cancelled Details
CI / test-sanitizer-address (push) Has been cancelled Details
CI / build-debian-old (push) Has been cancelled Details
CI / build-macos-latest (push) Has been cancelled Details
CI / build-32bit (push) Has been cancelled Details
CI / build-libc-malloc (push) Has been cancelled Details
CI / build-centos-jemalloc (push) Has been cancelled Details
CI / build-old-chain-jemalloc (push) Has been cancelled Details
External Server Tests / test-external-standalone (push) Has been cancelled Details
External Server Tests / test-external-cluster (push) Has been cancelled Details
External Server Tests / test-external-nodebug (push) Has been cancelled Details
Spellcheck / Spellcheck (push) Has been cancelled Details

Fix https://github.com/redis/redis/issues/13612
This bug was introduced by https://github.com/redis/redis/issues/11465

This PR added the incremental defragmentation for db->expires.
If the time for the defragmentation cycle has not arrived, it will exit
unless both cursor and expires_cursor are 0, meaning both keys and
expires have been fragmented.
However, the expires_cursor check has now been overlooked, which leads
to we will exit immediately even if the defragmentation doesn't reach
the end time, which will cause the efficiency of defragmentation to
become very low.

Note that this bug was already fixed in version
7.4(https://github.com/redis/redis/pull/13058)
This commit is contained in:
debing.sun 2025-08-14 10:37:23 +08:00 committed by GitHub
parent 5a752e1978
commit 0c5a8cca96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -1040,7 +1040,7 @@ void activeDefragCycle(void) {
server.stat_active_defrag_hits - prev_defragged > 512 ||
server.stat_active_defrag_scanned - prev_scanned > 64)
{
if (!cursor || ustime() > endtime) {
if (!(cursor || expires_cursor) || ustime() > endtime) {
quit = 1;
break;
}