nirdosh0110 opened a new pull request, #8707: URL: https://github.com/apache/hbase/pull/8707
JIRA: https://issues.apache.org/jira/browse/HBASE-30433 ### Summary Seed the master's `flushedSequenceIdByRegion` watermark 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 orphaned `recovered.edits`. ### Why The master already seeds this watermark with `openSeqNum` at region **OPEN**. That is the correct primary fence and fires on every reopen path, but it leaves one narrow graceful-close window uncovered: 1. A region is gracefully closed on the source RS (memstore flushed to the close marker). 2. The source RS dies **before** the target RS finishes `OPEN`, so the OPEN-time seed has not fired. 3. The source RS's SCP splits its WAL in that window, filtering against a still-stale `flushedSequenceIdByRegion`, and writes a (harmless-but-present) `recovered.edits` file. 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 `RegionStateTransition` message already carries an optional `openSeqNum` field and the `CLOSED` transition is already routed through the same master-side handler. - **RegionServer** — `CloseRegionHandler` and `UnassignRegionHandler` report `HRegion.getMaxFlushedSeqId()` on the `CLOSED` transition (was `HConstants.NO_SEQNUM`). `HRegionServer.createReportRegionStateTransitionRequest` now sets the wire `openSeqNum` field for `CLOSED` too (when `>= 0`), not just `OPENED`. - **Master** — `AssignmentManager` seeds the watermark on the `CLOSED` transition via `serverManager.reportRegionOpen(regionInfo, seqId)` when `seqId >= 0` (the existing atomic max-merge). ### Test Adds `TestGetLastFlushedSequenceId#testFlushedSequenceIdSeededOnRegionClose`: write + flush past `openSeqNum`, `disableTable` (a graceful close that keeps the region — unlike delete/split/merge, disable does not call `ServerManager#removeRegion`), then assert the watermark reflects the post-close flushed seqid. Local run (JDK17): `TestGetLastFlushedSequenceId` 3/3 and `TestServerManager` 5/5 green; `spotless:check` on `hbase-server` clean. ### Note on stacking This builds on #8584 (HBASE-30335), which introduces the `ServerManager.reportRegionOpen` seed this reuses. #8584 is not yet merged, so this PR currently includes its commits; it should be merged **after** #8584. Once #8584 lands, I will rebase so only the CLOSE-time commit remains. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
