zjncs opened a new pull request, #11102:
URL: https://github.com/apache/rocketmq/pull/11102
### Motivation
`ConsumerFilterManager.register` stores `ConsumerFilterData` **without**
bloom data whenever the filter bit map is disabled:
```java
BloomFilterData bloomFilterData = null;
if (this.brokerController == null
||
this.brokerController.getBrokerConfig().isEnableCalcFilterBitMap()) { //
default: false
bloomFilterData = bloomFilter.generate(consumerGroup + "#" + topic);
}
```
On restart, `decode` validates every persisted entry with
`bloomFilter.isValid(filterData.getBloomFilterData())`, and `isValid(null)`
returns `false` — so a single null-bloom entry flips `bloomChanged` and **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 (`ExpressionMessageFilter`
matches everything when `consumerFilterData == null`).
### Modifications
- Only run the bloom-changed check for entries that actually carry bloom
data: `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 via `encode()`, reloads via
`decode()`):
```
ConsumerFilterManagerTest.testDecodeKeepsFilterDataRegisteredWithoutBloomData:70
Expecting actual not to be null
```
Pass-after — full `ConsumerFilterManagerTest` (10 existing + 1 new):
```
mvn -pl broker test -Dtest='ConsumerFilterManagerTest'
Tests run: 11, Failures: 0, Errors: 0, Skipped: 0
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]