Pause dict auto-resize during multi-field deletion#14783
Merged
Conversation
🤖 Augment PR SummarySummary: Pauses dict auto-resizing during multi-element deletions in 🤖 Was this summary useful? React with 👍 or 👎 |
Collaborator
|
@slice4e i make some copyright changes for t_hash.c and top comment, please take a look, thx. |
sundb
approved these changes
Feb 14, 2026
Merged
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The idea comes directly from ValKey: valkey-io/valkey#3144
Deleting many fields from a hash/zset/set stored as a dict can trigger repeated shrink/rehash work during the loop.
Co-authored-by: Binbin binloveplay1314@qq.com
Note
Medium Risk
Touches core write-path commands and dict resizing behavior; while intended as a performance optimization, incorrect pause/resume or shrink timing could affect memory usage or trigger edge-case regressions under heavy deletion workloads.
Overview
Improves deletion performance for hash/set/zset values backed by dicts by pausing dict auto-resize during
HDEL,SREM, andZREMmulti-argument loops, then resuming and callingdictShrinkIfNeeded()once if the key wasn’t removed.Updates the set rehashing unit test to issue
SREMcommands in a deferred pipeline (instead of a single variadic call) to better exercise the new resize/shrink behavior during repeated deletions.Written by Cursor Bugbot for commit 1d4671f. This will update automatically on new commits. Configure here.