tisonkun commented on code in PR #1905:
URL: https://github.com/apache/zookeeper/pull/1905#discussion_r962137523


##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/PrepRequestProcessor.java:
##########
@@ -359,9 +355,6 @@ protected void pRequest2Txn(int type, long zxid, Request 
request, Record record,
         case OpCode.delete:
             zks.sessionTracker.checkSession(request.sessionId, 
request.getOwner());
             DeleteRequest deleteRequest = (DeleteRequest) record;
-            if (deserialize) {

Review Comment:
   No. Previously we need this boolean flag because, after deserializing 
`MultiOperationRecord`, the subrequest is an in-memory data structure - there 
are no more bytes in the request to be deserialized.
   
   Now, we always deserialize in `pRequestHelper`, no serialization happens in 
`pRequest2Txn`. Besides, we always serialize at most once in `RequestRecord`:
   
   ```java
   public class ByteBufferRequestRecord {
       @Override
       public <T extends Record> T readRecord(Supplier<T> constructor) throws 
IOException {
           if (record != null) {
               return (T) record;
           }
          // serialization
       }
   }
   
   public class SimpleRequestRecord {
       @Override
       public <T extends Record> T readRecord(Supplier<T> constructor) {
           return (T) record;
       }
   }
   ```



-- 
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: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to