pan3793 opened a new pull request, #8649: URL: https://github.com/apache/hadoop/pull/8649
### Description of PR The Checkpointer triggers the first checkpoint when `shouldCheckpointAtStartup()` returns true by leaving `lastCheckpointTime = 0` and relying on `now >= lastCheckpointTime + checkpointPeriodMSec` to evaluate true. This condition breaks when `monotonicNow()` (`System.nanoTime` based) returns a value smaller than `checkpointPeriodMSec` (3600000ms = 1 hour), which happens on freshly booted VMs such as GitHub-hosted runners. The checkpoint never fires, and any caller waiting for it hangs indefinitely. Add an explicit `lastCheckpointTime == 0` check so the first checkpoint fires immediately regardless of the monotonic clock value. After the first checkpoint, `lastCheckpointTime` is set to the current time and normal period-based scheduling resumes. This is a latent bug present since the Checkpointer logic was introduced in 2011 (a196766). It was exposed by the GitHub-hosted runner image `ubuntu24/20260720.247`, which provisions VMs fast enough that host uptime is below 1 hour at test execution. A BackupNode that restarts within 1 hour of boot on any deployment has the same bug. ### How was this patch tested? Verified via GitHub Actions CI on a fork branch. Before the fix, `TestBackupNode` hangs indefinitely (fork timeout after 900s). After the fix, the Checkpointer fires the startup checkpoint immediately and `TestBackupNode` passes. ### For code changes: - [x] Does the title or this PR starts with the corresponding JIRA issue id (HDFS-17955)? - [ ] Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, `NOTICE-binary` files? ### AI Tooling If an AI tool was used: - [x] The PR includes the phrase "Contains content generated by GLM 5.2" where GLM 5.2 is the name of the AI tool used. - [x] My use of AI contributions follows the ASF legal policy https://www.apache.org/legal/generative-tooling.html Contains content generated by GLM 5.2 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
