Skip to content

[python] Fix bucket registration for dynamic bucket overflow - #9788

Merged
JingsongLi merged 1 commit into
apache:masterfrom
QuakeWang:python-bucket-overflow
Sep 14, 2026
Merged

JingsongLi merged 1 commit into
apache:masterfrom
QuakeWang:python-bucket-overflow

Conversation

@QuakeWang

Copy link
Copy Markdown
Member

Purpose

Follow-up on #7363. Newly allocated buckets received count entries before candidate registration, causing registration to be skipped. Once the bucket limit was reached, only the first bucket remained eligible for random assignment.

Register each bucket when it is allocated, keeping candidates complete and duplicate-free while preserving the random selection strategy and existing hash mappings.

Tests

  • Added regression tests for bucket registration, overflow candidates, and existing hash mappings.
  • Simple hash bucket assigner and dynamic bucket tests: 26 passed.
  • Flake8 and license header checks passed.

Register each bucket when it is selected as a new bucket. Previously, later buckets received count entries before registration, leaving only the first bucket eligible for overflow assignment.

Add regression coverage for complete, duplicate-free candidates and stable existing hash mappings.

Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>

@JingsongLi JingsongLi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed d261f98. Requirement fit: SUPPORTED. Implementation: CLEAN.

The registration move fixes a reachable write imbalance: after allocating several dynamic buckets and reaching the configured cap, the old candidate list contained only the first bucket, so new keys accumulated there. Registering at allocation preserves the complete candidate set while existing hash-to-bucket mappings remain stable.

The exact-head simple assigner and dynamic-bucket suites passed locally: 26 tests, including all-candidate overflow and repeated-key checks. Current CI is also successful. No blocking issue found.

@JingsongLi
JingsongLi merged commit eaeac0b into apache:master Sep 14, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants