镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[Bug] Persist empty checkpoint state - #11032

Open
zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/checkpoint-empty-state
Open

zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/checkpoint-empty-state

Conversation

@zjncs

@zjncs zjncs commented Sep 5, 2026

Copy link
Copy Markdown

Fixes #10863

CheckpointFile now writes a valid zero-entry checkpoint instead of ignoring an empty list. Reading falls back to the backup only when the primary is missing or invalid, so a valid empty primary cannot resurrect stale backup entries.

Added regression coverage for overwriting a populated checkpoint with an empty state.

Verification: git diff --check passed; Maven unavailable locally, CI should run CheckpointFileTest. AI-assisted contribution.

Signed-off-by: zjncs <18910855655@163.com>
@zjncs
zjncs marked this pull request as ready for review September 5, 2026 09:29
Copilot AI lite review requested due to automatic review settings September 5, 2026 09:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@RockteMQ-AI RockteMQ-AI 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.

Summary

Correct fix — the original code treated empty checkpoint as invalid and would skip writing it, causing stale data to persist. An empty checkpoint is a valid state that should be persisted.

Changes:

  • write(): Removed the early return for empty entries
  • read(): Check file existence instead of content emptiness to decide fallback

The test validates that writing an empty list after a non-empty one correctly returns empty on read.

LGTM.


Automated review by github-manager-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] CheckpointFile cannot persist empty checkpoints

3 participants