Skip to content

Defrag should only skip non-existent dbs, not empty dbs#2379

Merged
enjoy-binbin merged 2 commits into
valkey-io:unstablefrom
enjoy-binbin:defrag
Jul 27, 2025
Merged

Defrag should only skip non-existent dbs, not empty dbs#2379
enjoy-binbin merged 2 commits into
valkey-io:unstablefrom
enjoy-binbin:defrag

Conversation

@enjoy-binbin

Copy link
Copy Markdown
Member

In #1609, we now doing on-demand database allocation instead
of preallocation. And in beginDefragCycle, we should not skip
empty databases if they exist. The defrag still defrags the
internal allocations of the hashtables structs if they exist.

Call chain: defragStageDbKeys -> defragStageKvstoreHelper ->
kvstoreHashtableDefragTables -> hashtableDefragTables.

In valkey-io#1609, we now doing on-demand database allocation instead
of preallocation. And in beginDefragCycle, we should not skip
empty databases if they exist. The defrag still defrags the
internal allocations of the hashtables structs if they exist.

Call chain: defragStageDbKeys -> defragStageKvstoreHelper ->
kvstoreHashtableDefragTables -> hashtableDefragTables.

Signed-off-by: Binbin <binloveplay1314@qq.com>
@enjoy-binbin enjoy-binbin added the run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP) label Jul 26, 2025
Signed-off-by: Binbin <binloveplay1314@qq.com>
@enjoy-binbin enjoy-binbin merged commit f21beaf into valkey-io:unstable Jul 27, 2025
54 of 59 checks passed
@enjoy-binbin enjoy-binbin deleted the defrag branch July 27, 2025 06:49
@xbasel

xbasel commented Jul 28, 2025

Copy link
Copy Markdown
Member

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-extra-tests Run extra tests on this PR (Runs all tests from daily except valgrind and RESP)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants