Skip to content

HBASE-30246 MOB compaction does not close MobCell after resolving ref…#8392

Open
liuxiaocs7 wants to merge 2 commits into
apache:masterfrom
liuxiaocs7:HBASE-30246
Open

HBASE-30246 MOB compaction does not close MobCell after resolving ref…#8392
liuxiaocs7 wants to merge 2 commits into
apache:masterfrom
liuxiaocs7:HBASE-30246

Conversation

@liuxiaocs7

Copy link
Copy Markdown
Member

…erence cells

@liuxiaocs7 liuxiaocs7 requested a review from Copilot June 22, 2026 07:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

This PR addresses HBASE-30246 by ensuring MOB reference resolution during compaction properly closes the MobCell and returns a safe, heap-resident copy of the resolved cell to avoid leaking scanners/buffers and referencing recycled NIO buffers.

Changes:

  • Introduce DefaultMobStoreCompactor#resolveMobCell(...) that closes MobCell and returns an independent copied ExtendedCell.
  • Update compaction paths to use resolveMobCell(...) instead of directly using mobStore.resolve(...).getCell().
  • Strengthen tests to use try-with-resources for MobCell and add a unit test verifying close + copy semantics.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java Adds resolveMobCell helper to close resolved MobCell and copy resolved cells safely; compaction updated to use it.
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java Aligns test compactor implementation with new resolveMobCell behavior.
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestDefaultMobStoreCompactor.java Adds unit test verifying resolveMobCell closes MobCell and returns an independent copy.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHMobStore.java Updates resolve test to close MobCell via try-with-resources and dereference via getCell().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* references.
*/
protected ExtendedCell resolveMobCell(ExtendedCell reference) throws IOException {
try (MobCell mobCell = mobStore.resolve(reference, cacheMobBlocksOnCompaction, false)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe protected ExtendedCell resolveMobCell(ExtendedCell reference, boolean flag) is better?

I think we can also reuse this method in the future if we need to call mobStore.resolve(reference, cacheMobBlocksOnCompaction, true) by this way

@liuxiaocs7 liuxiaocs7 Jun 23, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks @guluo2016 ! The false (readEmptyValueOnMobCellMiss) is coupled to this path's miss handling (it relies on resolve throwing, while true returns an empty cell needing different handling), so it can't be reused as-is. I'd prefer to add the param with a proper name once a real true caller appears, WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants