jvrao commented on a change in pull request #853: BP-14 WriteFlag DEFERRED_SYNC 
Client Side Implementation
URL: https://github.com/apache/bookkeeper/pull/853#discussion_r188504462
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerHandle.java
 ##########
 @@ -1678,17 +1692,23 @@ void sendAddSuccessCallbacks() {
                 return;
             }
             // Check if it is the next entry in the sequence.
-            if (pendingAddOp.entryId != 0 && pendingAddOp.entryId != 
lastAddConfirmed + 1) {
+            if (pendingAddOp.entryId != 0 && pendingAddOp.entryId != 
pendingAddsSequenceHead) {
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("Head of the queue entryId: {} is not lac: {} + 
1", pendingAddOp.entryId,
-                            lastAddConfirmed);
+                    LOG.debug("Head of the queue entryId: {} is not the 
expected value: {}", pendingAddOp.entryId,
+                               pendingAddsSequenceHead);
                 }
                 return;
             }
 
             pendingAddOps.remove();
             explicitLacFlushPolicy.updatePiggyBackedLac(lastAddConfirmed);
-            lastAddConfirmed = pendingAddOp.entryId;
+            if (writeFlags.contains(WriteFlag.DEFERRED_SYNC)) {
+                // cannot update LastAddConfirmed, we are not sure bookie has 
stored the entry durably at this point
+            } else {
+                this.lastAddConfirmed = Math.max(lastAddConfirmed, 
pendingAddOp.entryId);
+            }
 
 Review comment:
   Why are you changing this logic? Do you ever see a situation where 
lastAddConfirmed > pendingAddOp.entryId? If so then there is a problem right 
there. I would assert here rather than get Math.max. Also why can't you just 
check for !DEFERRED_SYNC?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to