Skip to content

HDFS-17960. Fix snapshot count mismatch during edit log replay - #8672

Merged
szetszwo merged 1 commit into
apache:trunkfrom
JHSUYU:HDFS-17960-snapshot-count-replay
Sep 23, 2026
Merged

szetszwo merged 1 commit into
apache:trunkfrom
JHSUYU:HDFS-17960-snapshot-count-replay

Conversation

@JHSUYU

@JHSUYU JHSUYU commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Description of PR

This PR fixes HDFS-17960.

When edit logs generated with ordered snapshot deletion enabled are replayed with ordered deletion disabled, multiple delete records may refer to the same snapshot. After the first record removes the snapshot DirectorySnapshottableFeature.removeSnapshot() returns null for a later duplicate record.

SnapshotManager.deleteSnapshot() previously ignored this return value and unconditionally decremented numSnapshots. This caused the counter to differ from the snapshots actually present in the namespace. A subsequent checkpoint could fail while serializing the snapshot section because the number of serialized snapshots did not matchnumSnapshots.

This change decrements numSnapshots only when removeSnapshot() actually returns a removed snapshot.

How was this patch tested?

This PR extends the existing ordered snapshot deletion restart test to verify:

  • The internal snapshot count matches the snapshot listing.
  • saveNamespace() can successfully create a checkpoint.

For code changes:

  • Does the title of this PR start with the corresponding JIRA issue id
    (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: Not applicable; this change only affects HDFS NameNode
    snapshot handling.
  • No new dependencies are added by this change.
  • No LICENSE, LICENSE-binary, or NOTICE-binary updates are required.

AI Tooling

If an AI tool was used:

@JHSUYU JHSUYU changed the title HDFS-17960. Fix snapshot count drift during edit log replay HDFS-17960. Fix snapshot count mismatch during edit log replay Aug 12, 2026
@JHSUYU

JHSUYU commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Hi @ZanderXu @szetszwo @pan3793 , could you take a look when you are available? Thanks very much!

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

+1 the change looks good.

@JHSUYU

JHSUYU commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

+1 the change looks good.

Hi @szetszwo, it seems no other reviewers have concerns. Could you help merge it? Thanks!

@szetszwo

Copy link
Copy Markdown
Contributor

@JHSUYU , there are some failures. Rerunning it.

@JHSUYU

JHSUYU commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

@JHSUYU , there are some failures. Rerunning it.

Thanks! Let me know if there is anything else I need to do

@szetszwo

Copy link
Copy Markdown
Contributor

@JHSUYU , it failed the second time. Could you take a look?

@JHSUYU

JHSUYU commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

@szetszwo This seems to be an infrastructure failure: the Jenkins agent hadoop16 disconnected during SCM checkout. I I tested the patch locally against the latest trunk, and everything seems good. I’m not sure if this is a Jenkins issue. Do you think rerunning it would solve the problem?

@JHSUYU

JHSUYU commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Hi @szetszwo , let me know if there is anything else I can do

@szetszwo

Copy link
Copy Markdown
Contributor

@JHSUYU , could you push a commit to sync with trunk? See if it could pass jenkins.

@JHSUYU
JHSUYU force-pushed the HDFS-17960-snapshot-count-replay branch from c0d22fa to 0968d68 Compare September 21, 2026 20:16
@JHSUYU

JHSUYU commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor Author

@szetszwo I synced the PR branch with the latest trunk as requested. Jenkins build failed again during SCM checkout because the hadoop16 agent became unresponsive (Ping timeout / Channel$OrderlyShutdown /
RequestAbortedException).

@JHSUYU
JHSUYU force-pushed the HDFS-17960-snapshot-count-replay branch from 0968d68 to f68ec54 Compare September 21, 2026 23:56
@pan3793

pan3793 commented Sep 22, 2026

Copy link
Copy Markdown
Member

Jenkins is unstable; GitHub Actions results can serve as a reference.

@JHSUYU

JHSUYU commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Jenkins is unstable; GitHub Actions results can serve as a reference.

Thanks. GitHub Actions have passed. @pan3793

@hadoop-yetus

Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 22s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 31m 22s trunk passed
+1 💚 compile 0m 59s trunk passed with JDK Ubuntu-21.0.12+8-1-24.04-Ubuntu
+1 💚 compile 1m 7s trunk passed with JDK Ubuntu-17.0.20+8-1-24.04-Ubuntu
+1 💚 checkstyle 1m 3s trunk passed
+1 💚 mvnsite 1m 6s trunk passed
+1 💚 javadoc 0m 58s trunk passed with JDK Ubuntu-21.0.12+8-1-24.04-Ubuntu
+1 💚 javadoc 0m 53s trunk passed with JDK Ubuntu-17.0.20+8-1-24.04-Ubuntu
+1 💚 spotbugs 2m 7s trunk passed
+1 💚 shadedclient 17m 0s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 48s the patch passed
+1 💚 compile 0m 43s the patch passed with JDK Ubuntu-21.0.12+8-1-24.04-Ubuntu
+1 💚 javac 0m 43s the patch passed
+1 💚 compile 0m 45s the patch passed with JDK Ubuntu-17.0.20+8-1-24.04-Ubuntu
+1 💚 javac 0m 45s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 41s the patch passed
+1 💚 mvnsite 0m 50s the patch passed
+1 💚 javadoc 0m 37s the patch passed with JDK Ubuntu-21.0.12+8-1-24.04-Ubuntu
+1 💚 javadoc 0m 41s the patch passed with JDK Ubuntu-17.0.20+8-1-24.04-Ubuntu
+1 💚 spotbugs 2m 5s the patch passed
+1 💚 shadedclient 16m 56s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 185m 59s hadoop-hdfs in the patch passed.
+1 💚 asflicense 0m 30s The patch does not generate ASF License warnings.
267m 2s
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8672/6/artifact/out/Dockerfile
GITHUB PR #8672
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 023ace45b91f 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / f68ec54
Default Java Ubuntu-17.0.20+8-1-24.04-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12+8-1-24.04-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20+8-1-24.04-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8672/6/testReport/
Max. process+thread count 4323 (vs. ulimit of 10000)
modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8672/6/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

@szetszwo

Copy link
Copy Markdown
Contributor

@JHSUYU , we finally got all +1 from yetus!

@szetszwo
szetszwo merged commit 2014707 into apache:trunk Sep 23, 2026
6 checks passed
@JHSUYU

JHSUYU commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

@JHSUYU , we finally got all +1 from yetus!

Thanks for the review!

@JHSUYU
JHSUYU deleted the HDFS-17960-snapshot-count-replay branch September 23, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants