Skip to content

HBASE-30335 Seed master flushedSequenceIdByRegion with openSeqNum on region OPEN (branch-2) - #8736

Merged
virajjasani merged 2 commits into
apache:branch-2from
nirdosh0110:HBASE-30335-branch-2
Oct 7, 2026
Merged

virajjasani merged 2 commits into
apache:branch-2from
nirdosh0110:HBASE-30335-branch-2

Conversation

@nirdosh0110

Copy link
Copy Markdown
Contributor

Backport of #8584 to branch-2 (JIRA: HBASE-30335).

Problem

The master's flushedSequenceIdByRegion is only updated by periodic RegionServer heartbeats. Right after a region OPEN the entry is absent or stale, so ServerManager.getLastFlushedSequenceId can return NO_SEQNUM (or an old value) and WALSplitter treats already-durable edits as unflushed. If the source RS of a graceful move crashes before the next heartbeat, SCP produces orphaned recovered.edits, which later block merge/split and leave regions stuck in RIT.

Change

  • ServerManager.reportRegionOpen(regionInfo, openSeqNum) seeds the cache with merge(openSeqNum, Math::max); AssignmentManager calls it on region OPEN.
  • updateLastFlushedSequenceIds now uses atomic compute() instead of get-then-put, so a stale in-flight heartbeat cannot overwrite the OPEN seed with a lower value.

Tests

  • New TestServerManager (seed, monotonicity, concurrent stale-heartbeat race).
  • TestGetLastFlushedSequenceId#testFlushedSequenceIdSeededOnRegionOpen; existing test updated for the new invariant.
  • AbstractTestDLS#makeWAL aligns synthetic WAL seqids with openSeqNum.

Backport notes

  • TestGetLastFlushedSequenceId: kept branch-2's HMaster#getLastSequenceId / MiniHBaseCluster APIs.
  • The master-side TestMaster#testFlushedSequenceIdPersistLoad change is dropped — flushed-seqid persistence does not exist on branch-2.

Verification (local, JDK17, -Dhadoop.profile=3.0)

  • mvn -pl hbase-server test -Dtest=TestServerManager,TestGetLastFlushedSequenceId,TestDLSFSHLog,TestDLSAsyncFSWAL → Tests run: 11, Failures: 0, Errors: 0
  • mvn -pl hbase-server spotless:check → BUILD SUCCESS

…region OPEN

Backport of apache#8584 to branch-2.

- ServerManager.reportRegionOpen(regionInfo, openSeqNum) seeds the master's
  flushed-sequence cache via merge(openSeqNum, Math::max); called from
  AssignmentManager on region OPEN.
- updateLastFlushedSequenceIds now uses atomic compute() so a stale in-flight
  heartbeat cannot clobber the OPEN seed with a lower value.
- Tests: new TestServerManager; TestGetLastFlushedSequenceId covers the OPEN
  seed; AbstractTestDLS#makeWAL respects the openSeqNum invariant.

The TestMaster#testFlushedSequenceIdPersistLoad change from master is not
applicable: flushed sequence id persistence does not exist on branch-2.
…TestMergeTableRegionsProcedure

With the OPEN-time seed, the master's flushed watermark equals openSeqNum, so
HBASE-30352 dropped the planted seqid-1 recovered.edits file as stale and the
merge succeeded instead of exercising the CHECK_CLOSED_REGIONS rollback path.
Name the file Long.MAX_VALUE so it always needs replay.
@virajjasani
virajjasani merged commit f510155 into apache:branch-2 Oct 7, 2026
28 of 30 checks passed
virajjasani pushed a commit that referenced this pull request Oct 7, 2026
…region OPEN (#8736) (#8584)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Signed-off-by: Andrew Purtell <apurtell@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
Signed-off-by: Aman Poonia <apoonia@salesforce.com>
virajjasani pushed a commit that referenced this pull request Oct 7, 2026
…region OPEN (#8736) (#8584)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Signed-off-by: Andrew Purtell <apurtell@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
Signed-off-by: Aman Poonia <apoonia@salesforce.com>
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