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
- Write a checkpoint containing entries.
- Write an empty entry list to the same
CheckpointFile.
- Read the checkpoint.
- 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.
Runtime platform environment
macOS; reproduced with a temporary checkpoint file in the
commonmodule.RocketMQ version
Branch:
developGit commit:
fd0c95920e0deac96ce2ae27442747cc5e65e930JDK Version
Eclipse Temurin 17.0.19+10
Describe the Bug
CheckpointFile.writereturns 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
CheckpointFile.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.