Skip to content

HDDS-17089. SCM that stops during snapshot install after the DB swap restarts pre-finalized and shuts down every finalized datanode - #11800

Open
sodonnel wants to merge 1 commit into
apache:masterfrom
sodonnel:HDDS-17089
Open

sodonnel wants to merge 1 commit into
apache:masterfrom
sodonnel:HDDS-17089

Conversation

@sodonnel

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

When a follower SCM installs a Raft snapshot, the DB is replaced atomically in step 1, then the VERSION file is written in step 2. A crash between those two steps leaves:

  • VERSION file → pre-finalization version
  • DB (metaTable) → post-finalization version

The Raft log replay cannot recover this because finalization happened before the checkpoint index. On the next start, the SCM's versionManager reads only the VERSION file, believes it is pre-finalized, and then its datanode server rejects every datanode that was actually finalized — causing a cluster outage.

This issue was found and the fix generated by AI.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-17089

How was this patch tested?

New unit test to prove the issue is resolved.

…restarts pre-finalized and shuts down every finalized datanode
Copilot AI balanced review requested due to automatic review settings October 27, 2026 13:22
@sodonnel sodonnel added AI-gen zdu Pull requests for Zero Downtime Upgrade (ZDU) https://issues.apache.org/jira/browse/HDDS-14496 labels Oct 27, 2026
@github-actions github-actions Bot added the scm label Oct 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Static review found no blocking issues in the bounded recovery logic, startup placement, or regression coverage; tests were not executed.

No open issues 🎉

What changed in this PR

This PR fixes SCM startup recovery after an interrupted Raft snapshot installation leaves the DB ahead of the VERSION file, preventing SCM from incorrectly rejecting finalized datanodes.

Changes:

  • Reconciles SCM’s apparent version with the DB during startup.
  • Adds bounded finalization so recovery stops at the DB version rather than the software version.
  • Adds regression coverage for version mismatches and documents startup-time upgrade actions.
File Description
hadoop-hdds/​server-scm/​src/​test/​java/​org/​apache/​hadoop/​hdds/​scm/​upgrade/​TestScmStartupInvalidApparentVersion.java Tests recovery when the DB version is ahead and preserves behavior when it is behind.
hadoop-hdds/​server-scm/​src/​main/​java/​org/​apache/​hadoop/​hdds/​upgrade/​ScmUpgradeAction.java Documents that upgrade actions can run during SCM construction.
hadoop-hdds/​server-scm/​src/​main/​java/​org/​apache/​hadoop/​hdds/​scm/​server/​StorageContainerManager.java Invokes DB-version reconciliation during startup.
hadoop-hdds/​framework/​src/​main/​java/​org/​apache/​hadoop/​ozone/​upgrade/​RatisBasedVersionManager.java Adds recovery to the apparent version recorded in the DB.
hadoop-hdds/​framework/​src/​main/​java/​org/​apache/​hadoop/​ozone/​upgrade/​ComponentVersionManager.java Allows finalization up to a specified version.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-gen scm zdu Pull requests for Zero Downtime Upgrade (ZDU) https://issues.apache.org/jira/browse/HDDS-14496

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants