RockteMQ-AI commented on issue #10863:
URL: https://github.com/apache/rocketmq/issues/10863#issuecomment-5225829212
**Issue Evaluation**
Category: `bug` | Status: **Confirmed**
The reported issue has been verified against the current codebase (commit
`fd0c959`).
**Root Cause:** `CheckpointFile.write()` returns immediately when the entry
list is empty (line 74: `if (entries.isEmpty()) { return; }`), never persisting
the empty state. Additionally, `read()` falls back to the backup file when the
primary returns an empty list (`CollectionUtils.isEmpty(result)`), so a valid
empty primary can be replaced by stale backup data.
**Impact:** Components relying on checkpoint persistence (e.g., consumer
offset tracking) may recover stale state after a restart if the last checkpoint
was intended to be empty.
**Severity:** medium — data correctness issue in edge case (empty checkpoint
scenarios)
**Suggested Fix:**
- `write()`: Persist empty checkpoints by writing `0\n<crc32>\n` to both
primary and backup files.
- `read()`: Only fall back to backup when the primary file is missing or
unreadable, not when it contains a valid empty checkpoint.
An automated fix proposal will be generated. Reply `/approve` to proceed
with PR generation.
---
*Automated evaluation by RockteMQ-AI*
--
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]