Skip to content

HBASE-30463 HMaster fails to initialize when the procedure store contains more than one ServerCrashProcedure for the same server - #8742

Open
craffit wants to merge 1 commit into
apache:branch-2.6from
craffit:HBASE-30463
Open

craffit wants to merge 1 commit into
apache:branch-2.6from
craffit:HBASE-30463

Conversation

@craffit

@craffit craffit commented Oct 6, 2026

Copy link
Copy Markdown

https://issues.apache.org/jira/browse/HBASE-30463

Since HBASE-28158, HMaster#finishActiveMasterInitialization collects the unfinished
ServerCrashProcedures with Collectors.toMap(ServerCrashProcedure::getServerName, Procedure::getSubmittedTime) and no merge function. If the procedure store holds two
unfinished SCPs for the same ServerName, the collector throws
IllegalStateException: Duplicate key ... and the master aborts. It aborts again on
every restart, because the same store is reloaded. Before HBASE-28158 these procedures
were collected into a Set, which tolerated duplicates.

Duplicate SCPs can be persisted because the submission guards rely on in-memory
DeadServer state. DeadServer#cleanPreviousInstance removes the old server name while
its SCP is still running, as soon as a new instance on the same host and port reports in.

The fix adds Math::min as the merge function. That keeps the earliest submit time as
the crash time, matching DeadServer#putIfAbsent. Both SCPs are still loaded and run
one after the other, because they take the same exclusive server lock.

TestMasterStartupWithDuplicateSCPs holds the server lock so that two SCPs for the same
server stay unfinished in the store. It then restarts the master and verifies that the
master initializes and both procedures complete.

Affects 2.5.14+, 2.6.5+, 2.7.0 and 3.0.0. This patch is on hbase-2.6

🤖 Generated with Claude Code

The JIRA lists only master as the component and has no fix versions yet. Committers usually want the master PR first and backport from there. The change applies to master unchanged, so you could open it against master instead and note that it cherry-picks cleanly onto branch-2.6.

…ains more than one ServerCrashProcedure for the same server

Merge duplicate SCPs per server with Math::min instead of throwing on the duplicate key.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.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.

1 participant