Skip to content

HBASE-30213 Use atomic MemStore totals for region size checks - #8869

Open
Sigma-Ma wants to merge 1 commit into
apache:masterfrom
Sigma-Ma:HBASE-30213-fix-spurious-region-too-busy-exception
Open

Sigma-Ma wants to merge 1 commit into
apache:masterfrom
Sigma-Ma:HBASE-30213-fix-spurious-region-too-busy-exception

Conversation

@Sigma-Ma

@Sigma-Ma Sigma-Ma commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

JIRA: https://issues.apache.org/jira/browse/HBASE-30213.

What changes were proposed in this pull request?

Maintain an atomic heap-plus-off-heap MemStore total in HRegion through the existing increment/decrement paths. Use this total for write-blocking and flush threshold checks, including WAL replay, and account for the additional counter's heap overhead.

Per-component statistics, configured thresholds and the meta-region exemption remain unchanged. No public API or shared MemStoreSizing implementation is changed.

Why are the changes needed?

Heap and off-heap counters are read independently. A read spanning a flush and subsequent writes can combine values from different points in time and overestimate the total, causing a spurious RegionTooBusyException or an unnecessary flush request.

The change removes these mixed-counter reads from region threshold checks. It does not make the component counters, aggregate and actual memory changes transactional. They can temporarily differ while updates overlap, and transient rejections are still possible. Once updates complete, the aggregate must equal heap plus off-heap.

How was this patch tested?

Added coverage for mixed snapshots, threshold boundaries, nonzero mixed-sign deltas, exact accounting after concurrent updates, and real BASIC/EAGER in-memory compaction and flush with heap and off-heap allocation.

The tests also verify executor termination, WAL close attempts after a region close failure, and restoration of ChunkCreator.instance and chunkPoolDisabled, including when both region and WAL closure fail.

mvn -o -B -ntp -pl hbase-server -PsingleJVMTests '-Dtest=TestHRegionMemStoreSizing,TestHeapSize,TestHRegion#testMemstoreSnapshotSize+testMemstoreSizeAccountingWithFailedPostBatchMutate+testFlushAndMemstoreSizeCounting+testFlushSizeAccounting+testPutWithMemStoreFlush,TestHRegionReplayEvents,TestCompactingMemStore,TestCompactingToCellFlatMapMemStore' -Dsurefire.failIfNoSpecifiedTests=true -Dsurefire.rerunFailingTestsCount=0 test spotless:check

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.

1 participant