iloveeyjafjalla opened a new pull request, #11453:
URL: https://github.com/apache/rocketmq/pull/11453

   ## Which Issue(s) This PR Fixes
   
   Fixes #11452
   
   ## Problem
   
   `CheckpointFile.read` reports a crc32 mismatch with a `file=%s` label but 
passes `expectedCrc32` into it, so a corrupted checkpoint prints a checksum 
where the path belongs and never labels the expected value:
   
   ```
   Entries crc32 not match, file=823222925, truth=823222924
   ```
   
   The path being read is in scope (`read(String filePath)`) when the message 
is built.
   
   ## Change
   
   ```java
   - "Entries crc32 not match, file=%s, truth=%s", expectedCrc32, truthCrc32);
   + "Entries crc32 not match, file=%s, expected=%s, truth=%s", filePath, 
expectedCrc32, truthCrc32);
   ```
   
   ## Verification
   
   `CheckpointFileTest` (the module that already owns the checkpoint test) 
gains `testCrcMismatchReportsTheFileAndTheExpectedCrc`, which corrupts the 
stored crc32 on both the checkpoint and its `.bak` fallback and asserts the 
message names the path and the expected checksum. Before the change:
   
   ```
   java.lang.AssertionError: Entries crc32 not match, file=823222925, 
truth=823222924
   ```
   
   After the change, with JDK 8 (`mvn -B -ntp -pl remoting -am test 
-Dtest='CheckpointFileTest' -DfailIfNoTests=false -Djacoco.skip=true`):
   
   ```
   Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
   checkstyle:3.2.0:check: passed
   spotbugs:4.8.6.8:check: BugInstance size is 0
   ```
   
   The unit test is the verification for this one. The change was prepared with 
AI assistance and reviewed, tested and verified by me.
   


-- 
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]

Reply via email to