-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
Before Creating the Enhancement Request
- 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:
- Investigating message format corruption issues
- Debugging compatibility problems between different RocketMQ versions
- Troubleshooting message serialization/deserialization issues
- 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:
- Read the complete message content from the ByteBuffer
- 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
- Only print properties hex: Considered printing only the properties portion in hex, but the full message provides more context for debugging
- Print message body only: Considered printing only the message body, but properties are more critical for CRC validation issues
- 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
- Separate log level: Considered using a different log level, but
warnis appropriate for this error condition
Additional Context
No response