void-ptr974 opened a new pull request, #26145: URL: https://github.com/apache/pulsar/pull/26145
### Motivation BrokerService runs cleanUnloadedTopicFromCache as a best-effort cleanup after bundle unload. The previous implementation removed matching topics by name and could remove a newer topic future if a stale unload cleanup ran after the topic was loaded again. It also ran unload side effects even when the conditional cache removal did not remove the current entry. ### Modifications - Clean only topics that are still present in the captured topic future and are fenced. - Remove topics from the cache using the captured topic future so stale cleanup cannot remove a newer entry. - Skip unload events and related cache/stat cleanup when the topic entry was already removed or superseded. - Add BrokerService tests for preserving newer topic futures and cleaning inactive fenced topic futures. ### Verifying this change - ./gradlew :pulsar-broker:test --tests org.apache.pulsar.broker.service.BrokerServiceTest.testCleanUnloadedTopicFromCacheDoesNotRemoveNewTopicFuture --tests org.apache.pulsar.broker.service.BrokerServiceTest.testCleanUnloadedTopicFromCacheRemovesInactiveBundleTopicFuture - ./gradlew :pulsar-broker:checkstyleMain :pulsar-broker:checkstyleTest - git diff --check -- 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]
