Skip to content

[ISSUE #10863] Persist empty checkpoints without restoring stale backups - #11642

Open
BILLYisavailable wants to merge 2 commits into
apache:developfrom
BILLYisavailable:codex/fix-10863-empty-checkpoint
Open

BILLYisavailable wants to merge 2 commits into
apache:developfrom
BILLYisavailable:codex/fix-10863-empty-checkpoint

Conversation

@BILLYisavailable

Copy link
Copy Markdown

Which Issue(s) This PR Fixes

Brief Description

Persist an empty checkpoint instead of leaving the previous entries on disk. A valid empty primary must also take precedence over an older backup; use file existence, rather than an empty result, to select the missing-file fallback.

This affects EpochFileCache: truncating all entries produces an empty in-memory cache, but reopening the cache currently restores the old entries. The added regression reproduces expected: 0, actual: 3 on unchanged develop at 19352a246.

This follows up on the closed, unmerged #10868 and #11032. The existing IOException fallback is retained.

How Did You Test This Change?

  • Verified the empty-primary and truncate/reopen regressions fail before the fix.
  • All 6 CheckpointFileTest cases and 8 EpochFileCacheTest cases pass after the fix, including missing-primary, CRC mismatch, and entry-count corruption cases.
  • Checkstyle and SpotBugs pass in the same reactor build.
mvn -pl store -am -Dtest=CheckpointFileTest,EpochFileCacheTest \
  -Dsurefire.failIfNoSpecifiedTests=false \
  -Djacoco-maven-plugin.version=0.8.12 test

Tested with JDK 17 and Maven 3.9.11. The command-line JaCoCo override avoids JDK 17 instrumentation errors from the default 0.8.5; the project POM is unchanged.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 51.34%. Comparing base (19352a2) to head (91b9e76).

Files with missing lines Patch % Lines
...g/apache/rocketmq/common/utils/CheckpointFile.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11642      +/-   ##
=============================================
+ Coverage      51.33%   51.34%   +0.01%     
- Complexity     15036    15044       +8     
=============================================
  Files           1391     1391              
  Lines         103942   103940       -2     
  Branches       13643    13643              
=============================================
+ Hits           53354    53371      +17     
+ Misses         44329    44317      -12     
+ Partials        6259     6252       -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add common-module tests for empty-primary precedence and missing-primary backup recovery. The existing remoting tests execute common code, but the per-module JaCoCo report does not include that cross-module execution.

Validation: both new tests pass with Checkstyle and SpotBugs. A fresh JaCoCo report covers the changed executable line and both branches (100% patch coverage locally). No production or build configuration changes.
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

2 participants