Skip to content

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

Merged
petersomogyi merged 1 commit into
apache:masterfrom
craffit:HBASE-30463
Oct 14, 2026
Merged

petersomogyi merged 1 commit into
apache:masterfrom
craffit:HBASE-30463

Conversation

@craffit

@craffit craffit commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

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

…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 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

@petersomogyi I opened a new PR for https://issues.apache.org/jira/projects/HBASE/issues/HBASE-30463

@petersomogyi
petersomogyi merged commit 27396d6 into apache:master Oct 14, 2026
9 of 16 checks passed
petersomogyi pushed a commit that referenced this pull request Oct 14, 2026
…ains more than one ServerCrashProcedure for the same server (#8765)

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>
Signed-off-by: Peter Somogyi <psomogyi@apache.org>
(cherry picked from commit 27396d6)
(cherry picked from commit c535cd7)
petersomogyi pushed a commit that referenced this pull request Oct 14, 2026
…ains more than one ServerCrashProcedure for the same server (#8765)

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>
Signed-off-by: Peter Somogyi <psomogyi@apache.org>
(cherry picked from commit 27396d6)
petersomogyi pushed a commit that referenced this pull request Oct 14, 2026
…ains more than one ServerCrashProcedure for the same server (#8765)

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>
Signed-off-by: Peter Somogyi <psomogyi@apache.org>
(cherry picked from commit 27396d6)
petersomogyi pushed a commit that referenced this pull request Oct 14, 2026
…ains more than one ServerCrashProcedure for the same server (#8765)

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>
Signed-off-by: Peter Somogyi <psomogyi@apache.org>
(cherry picked from commit c535cd7)
petersomogyi pushed a commit that referenced this pull request Oct 14, 2026
…ains more than one ServerCrashProcedure for the same server (#8765)

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>
Signed-off-by: Peter Somogyi <psomogyi@apache.org>
(cherry picked from commit 27396d6)
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