guyinyou opened a new issue, #9852:
URL: https://github.com/apache/rocketmq/issues/9852

   ### Before Creating the Enhancement Request
   
   - [x] I have confirmed that this should be classified as an enhancement 
rather than a bug/feature.
   
   
   ### Summary
   
   When the error "CommitLog#checkAndDispatchMessage: failed to check message 
CRC, not found CRC in properties" occurs, the current implementation only logs 
a warning message without providing detailed message content for debugging. 
This enhancement adds logging of the full message content including topic, 
properties map, properties length, and the complete message in hexadecimal 
format to facilitate troubleshooting.
   
   ### Motivation
   
   When message CRC validation fails due to missing CRC in properties, it's 
difficult to diagnose the root cause without seeing the actual message content. 
This is especially problematic when:
   1. Investigating message format corruption issues
   2. Debugging compatibility problems between different RocketMQ versions
   3. Troubleshooting message serialization/deserialization issues
   4. Analyzing messages that fail CRC validation during recovery
   
   Having the full message content in logs will significantly improve the 
debugging experience and help identify the root cause of such failures more 
quickly.
   
   ### Describe the Solution You'd Like
   
   When the error "not found CRC in properties" occurs in 
`CommitLog#checkAndDispatchMessage`, the code should:
   1. Read the complete message content from the ByteBuffer
   2. Log the following information:
      - Topic name
      - Parsed properties map (as string)
      - Properties length
      - Full message content in hexadecimal format
   
   The implementation reads the full message by duplicating the ByteBuffer and 
backtracking to the message start position, then extracts and logs all relevant 
information when the error condition is detected.
   
   Implementation location: `org/apache/rocketmq/store/CommitLog.java` around 
line 619-632
   
   ### Describe Alternatives You've Considered
   
   1. **Only print properties hex**: Considered printing only the properties 
portion in hex, but the full message provides more context for debugging
   2. **Print message body only**: Considered printing only the message body, 
but properties are more critical for CRC validation issues
   3. **Add debug flag**: Considered adding a configuration flag to 
enable/disable this logging, but decided to always log since this is an error 
condition that should be investigated
   4. **Separate log level**: Considered using a different log level, but 
`warn` is appropriate for this error condition
   
   ### Additional Context
   
   _No response_


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