maoling commented on code in PR #1915:
URL: https://github.com/apache/zookeeper/pull/1915#discussion_r1118794742


##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/TxnLogToolkit.java:
##########
@@ -340,13 +341,15 @@ private static String getFormattedTxnStr(Record txn) 
throws IOException {
             for (int i = 0; i < txnList.size(); i++) {
                 Txn t = txnList.get(i);
                 if (i == 0) {
-                    txnData.append(Request.op2String(t.getType()) + ":" + 
checkNullToEmpty(t.getData()));
+                    txnData.append(Request.op2String(t.getType()) + ":" + 
(t.getType() == -1 ?
+                            ByteBuffer.wrap(t.getData()).getInt() : 
checkNullToEmpty(t.getData())));
                 } else {
-                    txnData.append(";" + Request.op2String(t.getType()) + ":" 
+ checkNullToEmpty(t.getData()));
+                    txnData.append(";" + Request.op2String(t.getType()) + ":" 
+ (t.getType() == -1 ?
+                            ByteBuffer.wrap(t.getData()).getInt() : 
checkNullToEmpty(t.getData())));

Review Comment:
   Good catch
   
   - Give this long expression a field, don't duplicate twice?   
   - The Transaction is special/strange, When executed successfully, it still 
have something marshalling like 
this(`setData:���/Txn/1677482572006���v2-1677482572006���`). Maybe removing 
non-printable non-ascii characters is a way to 
work(https://howtodoinjava.com/java/regex/java-clean-ascii-text-non-printable-chars/)
 (I'm not sure, You can ignore this)
   -  I did a comprehensive test for this tool for the following cases: 
       - Language (English, Chinese, Japanese, Arabic)
       - Small/large Transaction(suceessful or failed)
       - CRUD for all kind node type (Normal, TTL, container)
   



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