HBASE-XXXXX Tolerate stale recovered.edits below durable seqid in split/merge - #8599
Draft
nirdosh0110 wants to merge 1 commit into
Draft
HBASE-XXXXX Tolerate stale recovered.edits below durable seqid in split/merge#8599nirdosh0110 wants to merge 1 commit into
nirdosh0110 wants to merge 1 commit into
Conversation
…it/merge MergeTableRegionsProcedure and SplitTableRegionProcedure invoke AssignmentManagerUtil.checkClosedRegion during MERGE/SPLIT_CHECK_CLOSED_REGIONS. Today the check aborts the procedure if any recovered.edits file exists in the region directory, retaining the region lock and leaving the region CLOSED/RIT until the next master failover. This can happen on a graceful region move followed by the source RS's WAL split completing after the region has already reopened - and flushed - on the target RS. The recovered.edits file contains edits already durable in HFiles; the existence of the file is harmless but the check treats it as data-loss risk. Change checkClosedRegion so that, when recovered.edits are present, it consults ServerManager.getLastFlushedSequenceId for the region and inspects each recovered.edits filename (whose numeric name is the max seqid of edits in the file). If every file's max seqid is <= the region's durable seqid the files are removed and the procedure proceeds. Otherwise the previous abort behavior is preserved as a safe fallback. Follow-up to the discussion on PR apache#8584 (HBASE-30335).
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.
Context
Follow-up to the discussion on #8584 (HBASE-30335). @Apache9 suggested in #8584 (comment):
This PR implements that check for both
MergeTableRegionsProcedureandSplitTableRegionProcedure(both callAssignmentManagerUtil.checkClosedRegion).Draft: JIRA not yet filed — will fill in the number and force-push the title once assigned.
The incident this addresses
112d9f08was gracefully moved from RS-A → RS-B.openSeqNum=4997750282; all prior edits were durable in HFiles.recovered.editsfile for this region containingseqId=4997750280— an edit already flushed on HFile before RS-A closed.MergeTableRegionsProcedurelater hitMERGE_TABLE_REGIONS_CHECK_CLOSED_REGIONS, saw therecovered.editsfile, and threw. The region sat in CLOSED/RIT for ~49 min until master failover cleared it.Change
AssignmentManagerUtil.checkClosedRegionnow, whenhasRecoveredEditsis true:lastFlushedSequenceIdfromServerManager.formatRecoveredEditsFileName(maxEditWALSeqNum)— to get the file's max seqid.lastFlushedSequenceId, deletes those specific files and returns.Filename parsing avoids opening/reading the WAL edits; the writer contract already encodes the max seqid in the file name via
WALSplitUtil.getCompletedRecoveredEditsFilePath.Files
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManagerUtil.java— the tolerance logic.hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestAssignmentManagerUtil.java— new testtestCheckClosedRegionDropsStaleRecoveredEditsverifies (a) a stale file is dropped and the check passes, (b) a file with a fresh seqid still causes the abort.Local run
Notes / open questions
ServerManagerhas an authoritativelastFlushedSequenceIdfor the region. With HBASE-30335 landing, this will be the case immediately after region OPEN. Without HBASE-30335 it kicks in after the first flush heartbeat. In either case, the fallback matches today's behavior.recovered.editson region OPEN. Happy to file/pick that up separately if reviewers agree it should be in scope.