Skip to content

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

Closed
craffit wants to merge 1 commit into
apache:masterfrom
craffit:HBASE-30463
Closed

craffit wants to merge 1 commit into
apache:masterfrom
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 master

🤖 Generated with Claude Code

@petersomogyi

Copy link
Copy Markdown
Contributor

Hi @craffit, thanks for the PR! I added you as contributor in ASF Jira and assigned the ticket to you.
Can you open this PR for master branch instead of 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>
@craffit
craffit changed the base branch from branch-2.6 to master October 7, 2026 14:29
@craffit

craffit commented Oct 7, 2026

Copy link
Copy Markdown
Author

@petersomogyi thanks for pointer. I rebased onto master and retargeted this PR. Let me know what more i can do to facilitate review/improvements.

Also happy to offer backported PRs if that is useful.

@petersomogyi

Copy link
Copy Markdown
Contributor

@craffit For some reason Yetus does not handle correctly this PR due to the changed base branch. Could you open a new PR?

@craffit craffit closed this Oct 13, 2026
@craffit

craffit commented Oct 13, 2026

Copy link
Copy Markdown
Author

@petersomogyi i opened a new PR under #8765

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