iloveeyjafjalla opened a new issue, #11452: URL: https://github.com/apache/rocketmq/issues/11452
### Before Creating the Bug Report - [x] I have searched the [open issues](https://github.com/apache/rocketmq/issues) of this repository and believe that this is not a duplicate. - [x] This is a defect in Apache RocketMQ, not a usage question. - [x] I can reproduce this on the current `develop` branch. ### RocketMQ Version develop @ `5d68880cbdfa5c6d87b5681c5eb3684df0e18ef8` (the revision this was verified on) ### Describe the Bug When a checkpoint file's stored crc32 does not match its content, `CheckpointFile.read` throws an `IOException` that names the wrong value: ```java if (NOT_CHECK_CRC_MAGIC_CODE != expectedCrc32 && truthCrc32 != expectedCrc32) { final String err = String.format( "Entries crc32 not match, file=%s, truth=%s", expectedCrc32, truthCrc32); throw new IOException(err); } ``` `file=%s` is filled with `expectedCrc32`, so an operator who opens a corrupted checkpoint (epoch checkpoint, timer checkpoint, ...) reads e.g. ``` Entries crc32 not match, file=823222925, truth=823222924 ``` - the value after `file=` is a **checksum**, not the path that failed to load; - the expected checksum is never labelled, so the two numbers can only be told apart by guessing which is which. The path is right there in `read(String filePath)` when the message is built, so the diagnostic can name the file and label the expected value. ### Steps to Reproduce 1. Write a checkpoint through `CheckpointFile.write(entries)`. 2. Change the stored crc32 line (the second line) so it no longer matches the content, for both the checkpoint and its `.bak` fallback. 3. Call `CheckpointFile.read()` and read the exception message: ``` Entries crc32 not match, file=823222925, truth=823222924 ``` The same point is made by the test added with the fix (`CheckpointFileTest#testCrcMismatchReportsTheFileAndTheExpectedCrc`, in the `remoting` module where the checkpoint test already lives). ### What Did You Expect to See? The message names the file that failed to load and labels both checksums, e.g. ``` Entries crc32 not match, file=/tmp/store-test/epoch.ckpt.bak, expected=823222925, truth=823222924 ``` ### What Did You See Instead? `file=` carries a checksum and the expected checksum has no label, so the diagnostic cannot be read without knowing the implementation. -- 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]
