Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2a2f54e

Browse files
author
guyinyou
committed
feat: print full message when CRC not found in properties
When the error 'failed to check message CRC, not found CRC in properties' occurs,now it will print the full message content including topic, properties map,properties length, and full message hex for debugging purposes.Change-Id: I26d977e13802c5e69d01f16512e40d121dcff354Co-developed-by: Cursor <noreply@cursor.com>
1 parentb77f2ab commit2a2f54e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

‎store/src/main/java/org/apache/rocketmq/store/CommitLog.java‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,8 +618,18 @@ public DispatchRequest checkMessageAndReturnSize(java.nio.ByteBuffer byteBuffer,
618618
returnnewDispatchRequest(-1,false/* success */);
619619
}
620620
}else {
621+
// Read full message for logging when error occurs
622+
ByteBufferfullMessageBuffer =byteBuffer.duplicate();
623+
intmessageStartPos =fullMessageBuffer.position() -totalSize;
624+
fullMessageBuffer.position(messageStartPos);
625+
fullMessageBuffer.limit(messageStartPos +totalSize);
626+
byte[]fullMessageBytes =newbyte[totalSize];
627+
fullMessageBuffer.get(fullMessageBytes,0,totalSize);
628+
629+
// Print full message and especially properties
621630
log.warn(
622-
"CommitLog#checkAndDispatchMessage: failed to check message CRC, not found CRC in properties");
631+
"CommitLog#checkAndDispatchMessage: failed to check message CRC, not found CRC in properties. topic={}, properties={}, propertiesLength={}, fullMessageHex={}",
632+
topic,propertiesMap !=null ?propertiesMap.toString() :"null",propertiesLength,UtilAll.bytes2string(fullMessageBytes));
623633
returnnewDispatchRequest(-1,false/* success */);
624634
}
625635
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp