[ISSUE #S4] Keep persisted consumer filter data that has no bloom data - #11102
Open
zjncs wants to merge 1 commit into
Open
[ISSUE #S4] Keep persisted consumer filter data that has no bloom data#11102zjncs wants to merge 1 commit into
zjncs wants to merge 1 commit into
Conversation
When the filter bit map is disabled (enableCalcFilterBitMap defaults to false) register() persists ConsumerFilterData without bloom data. On restart, decode() feeds that null into bloomFilter.isValid(), which returns false for null, so one such entry flags the bloom filter as changed and the whole persisted filter table is dropped. Every SQL92 subscription then re-registers from scratch (or, if the consumer does not re-subscribe, the server-side filter silently matches everything). Only treat entries that actually carry bloom data as evidence of a changed bloom filter. Signed-off-by: zjncs <18910855655@163.com>
RockteMQ-AI
approved these changes
Sep 9, 2026
RockteMQ-AI
left a comment
Contributor
There was a problem hiding this comment.
Summary
Important bug fix — with enableCalcFilterBitMap=false (the default), register stores filter entries with null bloom data, but decode unconditionally validates bloom via isValid(null) which returns false, causing the entire persisted filter table to be discarded on every broker restart. The null-guard in the bloom-changed check is the correct minimal fix: entries without bloom data now survive restart, while genuinely changed bloom filters still trigger the discard as before. Test covers the encode/decode round-trip with the default config.
Automated review by github-manager
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.
Motivation
ConsumerFilterManager.registerstoresConsumerFilterDatawithout bloom data whenever the filter bit map is disabled:On restart,
decodevalidates every persisted entry withbloomFilter.isValid(filterData.getBloomFilterData()), andisValid(null)returnsfalse— so a single null-bloom entry flipsbloomChangedand the entire persisted filter table is discarded ("Bloom filter is changed!So ignore all filter data persisted"). With the default configuration every broker restart therefore loses all registered SQL92 consumer filters; consumers that re-subscribe rebuild them, but any consumer that does not re-send its subscription silently stops filtering server-side (ExpressionMessageFiltermatches everything whenconsumerFilterData == null).Modifications
if (filterData.getBloomFilterData() != null && !this.bloomFilter.isValid(...)). Entries registered with the bit map disabled now survive restart; a genuinely changed bloom filter still discards the table as before.Verification
Fail-before (new test on unpatched code — registers a SQL92 filter with
enableCalcFilterBitMap=false, persists viaencode(), reloads viadecode()):Pass-after — full
ConsumerFilterManagerTest(10 existing + 1 new):