void-ptr974 commented on code in PR #4789:
URL: https://github.com/apache/bookkeeper/pull/4789#discussion_r3288706499
##########
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:
Done. The batch read now returns the verified prefix before a later digest
mismatch, while preserving retry behavior when the first entry mismatches.
Added test coverage in
`testDigestMismatchAfterPartialVerificationReturnsVerifiedPrefix`. Pushed as
a5ee51a9dd.
--
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]