Skip to content

Fix snapshot recovery when hard links are unsupported - #19236

Merged
jt2594838 merged 2 commits into
apache:masterfrom
hongzhi-gao:fix/snapshot-copy-fallback-consistency
Nov 13, 2026
Merged

jt2594838 merged 2 commits into
apache:masterfrom
hongzhi-gao:fix/snapshot-copy-fallback-consistency

Conversation

@hongzhi-gao

@hongzhi-gao hongzhi-gao commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

Snapshot recovery without snapshot.log maintains a separate hard-link/copy branch. If the filesystem throws UnsupportedOperationException, recovery fails instead of copying the file. Its copy path also bypasses the force/error handling already used by logged snapshots.

Use the existing SnapshotFileUtils.createLinkOrCopy for this path, keeping directory selection and file-target registration unchanged. Add a regression that rejects hard links, restores the bytes by copying, deletes the source, and verifies the restored contents and target mapping. Add the JDK 17 test JVM opens required by the existing PowerMock fault injection. Explicitly declare the already-transitive powermock-api-support test dependency used by method replacement so dependency analysis passes.

Validation:

  • mvn verify -o -pl iotdb-core/datanode -am -DskipTests -Ddevelocity.off=true: passed, including dependency:analyze-only with no dependency problems.
  • mvn spotless:apply -o -pl iotdb-core/datanode -Ddevelocity.off=true: passed.
  • mvn test -o -pl iotdb-core/datanode -am '-Dtest=SnapshotFileUtilsTest,SnapshotLinkFallbackTest,IoTDBSnapshotTest' -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false -Ddevelocity.off=true: 15 passed, 1 pre-existing ignored test.
  • Cluster migration and crash-injection tests were not run.

This PR has:

  • been self-reviewed.
  • added a regression test for the changed recovery path.

Key changed classes: SnapshotLoader, SnapshotLinkFallbackTest.

@Caideyipi Caideyipi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the current head. The unsupported hard-link case now uses the shared copy fallback, and the regression test checks restored contents after deleting the source. No code issues found.

@jt2594838
jt2594838 merged commit 9a281f8 into apache:master Nov 13, 2026
46 of 48 checks passed
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.

3 participants