Repository navigation
HBASE-30433 Seed the master's flushedSequenceIdByRegion watermark with the region's final flushed seqid on region CLOSE - #8707
Open
nirdosh0110 wants to merge 1 commit into
Open
nirdosh0110 wants to merge 1 commit into
nirdosh0110 wants to merge 1 commit into
Conversation
nirdosh0110
force-pushed
the
HBASE-30433
branch
from
October 6, 2026 13:19
8e63fcf to
7b5b6a7
Compare
…h the region's final flushed seqid on region CLOSE On graceful region CLOSE the RegionServer now reports the region's durable flushed seqid (HRegion.getMaxFlushedSeqId()) on the CLOSED transition, and the master lifts its flushedSequenceIdByRegion watermark from it via the existing monotonic reportRegionOpen(merge(Math::max)) seed. This narrows the graceful-close window where a subsequent WAL split of a crashed source RS could otherwise treat already-durable edits as unflushed and write orphaned recovered.edits. No proto/RPC change: the RegionStateTransition message already carries an optional openSeqNum field and the CLOSED transition is already routed through the same master-side handler. HRegionServer now also sets that field for CLOSED (not just OPENED), and AssignmentManager seeds the watermark on CLOSED when seqId >= 0. Adds TestGetLastFlushedSequenceId#testFlushedSequenceIdSeededOnRegionClose.
nirdosh0110
force-pushed
the
HBASE-30433
branch
from
October 7, 2026 05:40
7b5b6a7 to
dc643a2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JIRA: https://issues.apache.org/jira/browse/HBASE-30433
Summary
Seed the master's
flushedSequenceIdByRegionwatermark with the region's final flushed seqid on region CLOSE, so a subsequent WAL split of a drained/crashed source RS recognizes already-durable edits instead of writing orphanedrecovered.edits.Why
The master already seeds this watermark with
openSeqNumat region OPEN. That is the correct primary fence and fires on every reopen path, but it leaves one narrow graceful-close window uncovered:OPEN, so the OPEN-time seed has not fired.flushedSequenceIdByRegion, and writes a (harmless-but-present)recovered.editsfile.Seeding on CLOSE advances the watermark to the region's reported flushed seqid before the source RS dies, closing this sub-window for the graceful-close case. This is additive: it does nothing for the pure-crash / never-gracefully-closed path (there is no close report), so the OPEN-time seed remains. Both writers go through the same monotonic
merge(Math::max), so they compose safely and never regress a higher value.Change
No protobuf/RPC change — the
RegionStateTransitionmessage already carries an optionalopenSeqNumfield and theCLOSEDtransition is already routed through the same master-side handler.CloseRegionHandlerandUnassignRegionHandlerreportHRegion.getMaxFlushedSeqId()on theCLOSEDtransition (wasHConstants.NO_SEQNUM).HRegionServer.createReportRegionStateTransitionRequestnow sets the wireopenSeqNumfield forCLOSEDtoo (when>= 0), not justOPENED.AssignmentManagerseeds the watermark on theCLOSEDtransition viaserverManager.reportRegionOpen(regionInfo, seqId)whenseqId >= 0(the existing atomic max-merge).Test
Adds
TestGetLastFlushedSequenceId#testFlushedSequenceIdSeededOnRegionClose: write + flush pastopenSeqNum,disableTable(a graceful close that keeps the region — unlike delete/split/merge, disable does not callServerManager#removeRegion), then assert the watermark reflects the post-close flushed seqid.Local run on current master (JDK17):
TestGetLastFlushedSequenceId3/3,TestServerManager5/5,TestMergeTableRegionsProcedure9/9,TestAssignmentManagerUtil3/3,TestMaster7/7,TestDLSFSHLog3/3,TestDLSAsyncFSWAL3/3 green;spotless:checkonhbase-serverclean.Note on stacking
Builds on #8584 (HBASE-30335, now merged to master), which introduced the
ServerManager.reportRegionOpenseed this reuses. Rebased onto master; this PR is now the single CLOSE-time commit.