hangc0276 commented on code in PR #4789:
URL: https://github.com/apache/bookkeeper/pull/4789#discussion_r3285063977


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BatchedReadOp.java:
##########
@@ -160,32 +165,41 @@ boolean complete(int bookieIndex, BookieId host, final 
ByteBufList bufList) {
             if (isComplete()) {
                 return false;
             }
-            if (!complete.getAndSet(true)) {
+
+            /*
+             * Verify the whole batch before creating LedgerEntryImpl 
instances. If any entry fails
+             * digest verification, no partial entries are retained and 
readEntriesComplete() releases
+             * the retained ByteBufList after this method returns false.
+             */
+            for (int i = 0; i < bufList.size(); i++) {
+                ByteBuf buffer = bufList.getBuffer(i);
+                try {
+                    lh.macManager.verifyDigestAndReturnData(eId + i, buffer);

Review Comment:
   One improvement is to return the entries before the digest mismatch one



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