Skip to content

Pause dict auto-resize during multi-field deletion#14783

Merged
sundb merged 4 commits into
redis:unstablefrom
slice4e:pause_auto_shrink
Feb 14, 2026
Merged

Pause dict auto-resize during multi-field deletion#14783
sundb merged 4 commits into
redis:unstablefrom
slice4e:pause_auto_shrink

Conversation

@slice4e

@slice4e slice4e commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

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, and ZREM multi-argument loops, then resuming and calling dictShrinkIfNeeded() once if the key wasn’t removed.

Updates the set rehashing unit test to issue SREM commands 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.

@augmentcode

augmentcode Bot commented Feb 10, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Pauses dict auto-resizing during multi-element deletions in HDEL, SREM, and ZREM for dict-backed encodings.
Why: Reduces repeated shrink/rehash work inside deletion loops, keeping behavior the same aside from the timing of dict resize decisions.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/t_hash.c

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Comment thread src/t_zset.c
@slice4e slice4e marked this pull request as draft February 10, 2026 21:22
@sundb sundb added this to Redis 8.8 Feb 11, 2026
@sundb

sundb commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

@slice4e i make some copyright changes for t_hash.c and top comment, please take a look, thx.

@slice4e slice4e marked this pull request as ready for review February 11, 2026 15:56

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/t_hash.c
@sundb sundb changed the title pause dict auto-resize during multi-field deletion Pause dict auto-resize during multi-field deletion Feb 14, 2026
@sundb sundb merged commit 98328ae into redis:unstable Feb 14, 2026
18 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Redis 8.8 Feb 14, 2026
@slice4e slice4e deleted the pause_auto_shrink branch March 18, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants