3pacccccc commented on code in PR #24955:
URL: https://github.com/apache/pulsar/pull/24955#discussion_r2508565736


##########
testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockLedgerHandle.java:
##########
@@ -160,6 +164,7 @@ public long addEntry(byte[] data) throws 
InterruptedException, BKException {
 
         lastEntry = entries.size();
         entries.add(LedgerEntryImpl.create(ledgerId, lastEntry, data.length, 
Unpooled.wrappedBuffer(data)));
+        totalLengthCounter.addAndGet(data.length);

Review Comment:
   switched order by incrementing the counter before adding to the list



##########
testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockLedgerHandle.java:
##########
@@ -193,6 +198,7 @@ public void asyncAddEntry(final ByteBuf data, final 
AddCallback cb, final Object
                     data.readBytes(storedData);
                     entries.add(LedgerEntryImpl.create(ledgerId, lastEntry,
                                                        storedData.length, 
Unpooled.wrappedBuffer(storedData)));
+                    totalLengthCounter.addAndGet(storedData.length);

Review Comment:
   switched order by incrementing the counter before adding to the list



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