Skip to content

HDDS-16442. Fix snapshot diff integrity failure recovery after upgrade - #11808

Draft
jojochuang wants to merge 3 commits into
apache:masterfrom
jojochuang:codex/HDDS-16442-snapshot-diff
Draft

jojochuang wants to merge 3 commits into
apache:masterfrom
jojochuang:codex/HDDS-16442-snapshot-diff

Conversation

@jojochuang

@jojochuang jojochuang commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Snapshot diff report integrity failures currently update the job using its generation ID instead of the snapshot-pair key used by the job table. The lookup returns null and throws an NPE, leaving the job DONE instead of marking it FAILED for cleanup. Older completed jobs without largestEntryKey also enter this failure path after an OM upgrade.

Pass the job-table key through report pagination to the integrity check, skip the last-entry comparison when the stored key is absent, and atomically mark only the matching DONE generation FAILED. Stale readers leave replacement, already-failed, and removed jobs untouched. Job cleanup and the integrity-failure transition share the DB monitor, preventing cleanup from deleting the row between the status check and update. Regression tests cover reading a completed job with a null stored last-entry key and persisting FAILED on a genuine mismatch with distinct job ID and job-table key.

Adapted from HDDS-16442.001.patch, attached by Siyao Meng. The patch is adapted to current master. The integrity-failure transition also checks the current job ID and status under the manager lock to protect replacement generations.

What is the link to the Apache JIRA

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

How was this patch tested?

Using JDK 21:

  • mvn -B -ntp -pl :ozone-manager -am test -Dtest=TestSnapshotDiffManager,TestSnapshotDiffCleanupService -Dsurefire.failIfNoSpecifiedTests=false -DskipShade -DskipRecon -DskipDocs: 75 tests passed (73 manager cases and 2 cleanup cases), zero failures or errors.
  • ./hadoop-ozone/dev-support/checks/checkstyle.sh: passed, zero violations.
  • Error Prone compilation with -pl :ozone-manager -am -Perrorprone test-compile -DskipTests -DskipShade -DskipRecon -DskipDocs: passed.
  • git diff --check: passed.

Generated-by: Specula (Claude Opus 4.8), as disclosed in the Jira; Codex (GPT-6) for adapting and validating the patch.

Change-Id: I27661c03858cc1e82677ef502d26b6bc44f7d0d2
Copilot AI balanced review requested due to automatic review settings October 27, 2026 23:10
@jojochuang jojochuang added snapshot https://issues.apache.org/jira/browse/HDDS-6517 AI-gen labels 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.

🟡 Changes recommended

A stale integrity check can mark a healthy replacement generation FAILED because the transition does not verify the job ID.

1 open issue
What changed in this PR

This PR fixes snapshot diff integrity-failure recovery in OM and preserves readability of completed jobs created before largestEntryKey was stored.

Changes:

  • Passes the snapshot-pair job key through pagination to integrity-failure status updates.
  • Skips last-entry comparisons for legacy jobs and guards updates when a job is missing.
  • Adds regression tests for legacy reports and genuine integrity failures.
File Description
hadoop-ozone/​ozone-manager/​src/​test/​java/​org/​apache/​hadoop/​ozone/​om/​snapshot/​TestSnapshotDiffManager.java Adds regression coverage and updates pagination calls.
hadoop-ozone/​ozone-manager/​src/​main/​java/​org/​apache/​hadoop/​ozone/​om/​snapshot/​SnapshotDiffManager.java Corrects recovery lookups and handles legacy and missing jobs.

Review effort: Balanced

@github-actions github-actions Bot added the om label Oct 27, 2026
Change-Id: I9a067647517f2ae511f6d5aa191d6ae552340593

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.

🟡 Changes recommended

Cleanup can delete an expired job between two lookups without the manager lock, causing recovery to throw an NPE instead of the intended IOException; shared synchronization or an atomic operation and a regression test are needed.

1 open issue
1 resolved since last review

Review effort: Balanced

Change-Id: If27454033da53cc3134539bdef0d145aa00ff707

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

No active review issues block the snapshot-diff recovery and legacy-job compatibility changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@SaketaChalamchala SaketaChalamchala 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.

@jojochuang Thanks for the patch. Created a PR jojochuang#635 for the following and updated the tests as well.

The current change bypasses the integrity check for legacy diff jobs with null largestEntrykey. I created above PR retaining the integrity check for the legacy jobs Pre - #9399. PTAL

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

Labels

AI-gen om snapshot https://issues.apache.org/jira/browse/HDDS-6517

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants