Repository navigation
Fix slot memory accounting after IDMP expiry - #15887
Merged
sggeorgiev merged 6 commits intoOct 28, 2026
Merged
Conversation
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
|
Hi, I'm Tomás, I build Perfloop. I approved this contribution and will handle review feedback here. We've had performance PRs merged in ClickHouse, Prometheus, Ruff/ty, parquet-go, RoaringBitmap, and more. This one fixes slot memory accounting after IDMP expiry. Happy to reshape anything to fit how you'd like it. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## unstable #15887 +/- ##
============================================
+ Coverage 77.50% 78.28% +0.78%
============================================
Files 146 155 +9
Lines 88000 90190 +2190
============================================
+ Hits 68203 70606 +2403
+ Misses 19797 19584 -213
🚀 New features to boost your workflow:
|
sggeorgiev
reviewed
Oct 15, 2026
Signed-off-by: Perfloop Agent <[email protected]> Signed-off-by: Tomás Senart <[email protected]>
sundb
reviewed
Oct 16, 2026
Removing the last producer already sets modified, so the empty-tree path reaches the slot-size update without the extra assignment. The regression now asserts the producer counts before expiry. Signed-off-by: Perfloop Agent <[email protected]> Signed-off-by: Tomás Senart <[email protected]>
sundb
reviewed
Oct 19, 2026
Signed-off-by: Perfloop Agent <[email protected]> Co-authored-by: Tomás Senart <[email protected]>
sundb
reviewed
Oct 20, 2026
Signed-off-by: Perfloop Agent <[email protected]>
|
Hi @sundb! Thanks for your reviews. Anything else you'd like us to do to wrap up this PR? |
sundb
approved these changes
Oct 28, 2026
Collaborator
|
@sggeorgiev do we need to backport this fix to old versions? |
This was referenced Oct 31, 2026
This was referenced Nov 6, 2026
Closed
This was referenced Nov 20, 2026
Closed
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 IDMP expiry cron now reconciles a stream's slot memory charge after expired entries and producer trees are removed. When it removes the last producer, the expiry index can release its key reference, so the update uses the key retained by the stream object.
The regression is in the existing
tests/unit/cluster/slot-stats.tclsuite. With memory tracking enabled at startup, it checks the keeper-only slot baseline after deleting streams with fully drained and partially expired IDMP histories. The strict Werror/TLS build, slot-stats unit, diskless-replication expiry cases, and focused AddressSanitizer regression pass. The comparison script and temporary test hooks are not included in the pull request.This condition holds with this change and does not hold at
6b8be852fc961301ec96d38f68dda08a0b0fedf9:In cluster mode with cluster-slot-stats-enabled mem at startup, after IDMP cron expiry and deletion of the stream key, CLUSTER SLOT-STATS memory-bytes for its hash slot equals the pre-stream baseline for both drained and partially expired producer histories..This repairs the per-slot
CLUSTER SLOT-STATSaccounting counter; it does not establish a physical heap leak.The required 32-bit build was not run in this environment; upstream CI must confirm it.
Generated by Perfloop. Human sponsor: Tomás Senart.
Note
Medium Risk
Touches cron-driven stream IDMP cleanup and cluster per-slot memory counters; behavior is gated on memory tracking and uses careful key lifetime handling after dict deletes.
Overview
Fixes cluster slot memory accounting when the IDMP expiry cron removes expired producer state from streams.
The cron now records the stream
kvobjsize before pruning, and when expiry actually changes the object it callsupdateSlotAllocSizesoCLUSTER SLOT-STATSmemory-bytesmatches freed IDMP data. It no longercontinues immediately after dropping the last producer from the expiry index, so that reconciliation still runs. The slot update useskvobjGetKey(kv)because removing the stream fromstream_idmp_keyscan free the iterator’skeypointer.Adds a cluster unit test (with
DEBUG ALLOCSIZE-SLOTS-ASSERT) that checks slot memory after fully drained and partially expired IDMP histories, thenDELon the stream, against a keeper-only baseline.Reviewed by Cursor Bugbot for commit 11915ee. Bugbot is set up for automated code reviews on this repo. Configure here.