yuluo-yx opened a new issue, #10863: URL: https://github.com/apache/rocketmq/issues/10863
## Runtime platform environment macOS; reproduced with a temporary checkpoint file in the `common` module. ## RocketMQ version Branch: `develop` Git commit: `fd0c95920e0deac96ce2ae27442747cc5e65e930` ## JDK Version Eclipse Temurin 17.0.19+10 ## Describe the Bug `CheckpointFile.write` returns immediately for an empty entry list, leaving old entries on disk. In addition, `read()` treats a valid empty primary file as a reason to load the backup, so stale backup entries can be restored instead of an intentionally empty state. ## Steps to Reproduce 1. Write a checkpoint containing entries. 2. Write an empty entry list to the same `CheckpointFile`. 3. Read the checkpoint. 4. Observe that old entries remain. A valid empty primary file also causes `read()` to return entries from its older backup. ## What Did You Expect to See? An empty list should be persisted as a valid zero-entry checkpoint, and reading that valid primary should return an empty list. Backup fallback should only occur when the primary is missing or invalid. ## What Did You See Instead? Empty writes are ignored, and a valid empty primary can be replaced in memory by stale backup content. ## Additional Context The existing count and CRC format can represent an empty checkpoint without a format change. -- 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]
