Skip to content

[ISSUE #9680] Improve RocksDB compaction filter factory resource management#9681

Merged
ltamber merged 4 commits intoapache:developfrom
RongtongJin:feature/rocksdb-improvements
Sep 11, 2025
Merged

[ISSUE #9680] Improve RocksDB compaction filter factory resource management#9681
ltamber merged 4 commits intoapache:developfrom
RongtongJin:feature/rocksdb-improvements

Conversation

@RongtongJin
Copy link
Copy Markdown
Contributor

@RongtongJin RongtongJin commented Sep 9, 2025

Which Issue(s) This PR Fixes

Fixes #9680

Brief Description

This PR improves RocksDB compaction filter factory resource management to prevent memory leaks and reduce component coupling. The main changes include:

  1. Refactor ConsumeQueueCompactionFilterFactory: Replace MessageStore dependency with LongSupplier functional interface to reduce coupling and improve testability
  2. Enhanced Resource Management: Add proper cleanup logic in ConsumeQueueRocksDBStorage.preShutdown() with null-safety checks
  3. Parameter Injection: Update RocksDBOptionsFactory to accept external compaction filter factory instances instead of creating them internally

How Did You Test This Change?

- Refactor ConsumeQueueCompactionFilterFactory to use LongSupplier instead of MessageStore
- Add proper resource cleanup in ConsumeQueueRocksDBStorage.preShutdown()
- Update RocksDBOptionsFactory to accept external compaction filter factory
- Optimize write buffer size for CQ rocksdb performance

This change improves resource management and reduces memory leaks by:
1. Decoupling compaction filter from MessageStore reference
2. Ensuring proper cleanup of native resources
3. Making compaction filter factory lifecycle manageable
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.03%. Comparing base (bb45b8f) to head (cf5b3c7).

Files with missing lines Patch % Lines
...etmq/store/rocksdb/ConsumeQueueRocksDBStorage.java 66.66% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #9681      +/-   ##
=============================================
- Coverage      48.09%   48.03%   -0.07%     
+ Complexity     12089    12078      -11     
=============================================
  Files           1313     1313              
  Lines          92929    92933       +4     
  Branches       11870    11871       +1     
=============================================
- Hits           44695    44639      -56     
- Misses         42721    42779      +58     
- Partials        5513     5515       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@fuyou001 fuyou001 left a comment

Choose a reason for hiding this comment

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

LGTM

@fujian-zfj
Copy link
Copy Markdown
Contributor

LGTM

@ltamber ltamber merged commit c3c6832 into apache:develop Sep 11, 2025
18 of 25 checks passed
@RongtongJin RongtongJin added the ha label Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Improve RocksDB compaction filter factory resource management

5 participants