sijie commented on a change in pull request #1375: BP14 - forceLedger bookie 
side implementation
URL: https://github.com/apache/bookkeeper/pull/1375#discussion_r185693521
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
 ##########
 @@ -1201,6 +1227,40 @@ public ByteBuf getExplicitLac(long ledgerId) throws 
IOException, Bookie.NoLedger
         return lac;
     }
 
+    /**
+     * Force sync given 'ledgerId' entries on the journal to the disk.
+     * This is useful for ledgers with DEFERRED_SYNC write flag
+     * for which the client receives acknoledgement for writes
+     * without the guarantee that data has been sync'd to disk 
(ackBeforeSync=true).
+     */
+    public void forceLedger(long ledgerId, WriteCallback cb,
+                            Object ctx, byte[] masterKey)
+                throws IOException, BookieException {
+        long requestNanos = MathUtils.nowInNano();
+        boolean success = false;
+        try {
+            LedgerDescriptor handle = handles.getHandle(ledgerId, masterKey);
+            synchronized (handle) {
+                if (handle.isFenced()) {
+                    throw BookieException
 
 Review comment:
   I don't think we need to fail force request even ledger is fenced, right? 

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