Skip to content

HBASE-30433 Seed the master's flushedSequenceIdByRegion watermark with the region's final flushed seqid on region CLOSE - #8760

Open
nirdosh0110 wants to merge 2 commits into
apache:branch-2from
nirdosh0110:HBASE-30433-branch-2
Open

nirdosh0110 wants to merge 2 commits into
apache:branch-2from
nirdosh0110:HBASE-30433-branch-2

Conversation

@nirdosh0110

Copy link
Copy Markdown
Contributor

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

Backport of #8707 to branch-2: cherry-pick -x of both master commits.

Summary

Seed the master's flushedSequenceIdByRegion watermark with the region's final flushed seqid on region CLOSE. A subsequent WAL split of a drained or crashed source RS then recognizes already-durable edits instead of writing orphaned recovered.edits. This complements the OPEN-time seed from HBASE-30335 (#8736, already on branch-2). Both go through the same monotonic merge(Math::max), so they can never regress a higher value.

Change

Test

TestGetLastFlushedSequenceId#testFlushedSequenceIdSeededOnRegionClose leaves edits unflushed, so the close's own flush advances maxFlushedSeqId; a heartbeat sent before the close can't carry that value. It then asserts that the master's watermark equals that value. With the CLOSE seed disabled, the test fails (expected 7, got 2).

Backport conflicts

  • UnassignRegionHandler: kept branch-2's hbase:meta read-replica removeCatalogReplicationSource block ahead of the CLOSED report.
  • TestGetLastFlushedSequenceId: SingleProcessHBaseCluster changed to MiniHBaseCluster.

Local run (JDK17, -Dhadoop.profile=3.0)

All green: TestGetLastFlushedSequenceId 3/3, TestServerManager 5/5, TestMergeTableRegionsProcedure 9/9, TestAssignmentManagerUtil 3/3, TestMaster 6/6, TestDLSFSHLog 2/2, TestDLSAsyncFSWAL 2/2. spotless:check is clean.

🤖 Generated with Claude Code

nirdosh.yadav added 2 commits October 13, 2026 10:50
…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.

(cherry picked from commit dc643a2)
…n close-seed test

- Rename ServerManager#reportRegionOpen to advanceRegionFlushedSeq since it is
  now called on both region OPEN and CLOSE; generalize its javadoc.
- testFlushedSequenceIdSeededOnRegionClose now leaves edits unflushed so the
  close flush itself advances maxFlushedSeqId (a pre-close heartbeat cannot
  carry that value), and asserts the master's watermark equals it. The old
  version passed even with the CLOSE seed disabled because 1s heartbeats
  delivered the same value.

(cherry picked from commit a9784fa)

@virajjasani virajjasani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1, awaiting workflow results

@virajjasani virajjasani changed the title HBASE-30433 Seed the master's flushedSequenceIdByRegion watermark with the region's final flushed seqid on region CLOSE (branch-2 backport) HBASE-30433 Seed the master's flushedSequenceIdByRegion watermark with the region's final flushed seqid on region CLOSE Oct 13, 2026
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.

2 participants