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

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
 ##########
 @@ -1201,6 +1209,22 @@ public ByteBuf getExplicitLac(long ledgerId) throws 
IOException, Bookie.NoLedger
         return lac;
     }
 
+    /**
+     * Force sync given 'ledgerId' entries on the journal to the disk.
+     * It works like a regular addEntry with ackBeforeSync=false.
+     * This is useful for ledgers with DEFERRED_SYNC write flag.
+     */
+    public void forceLedger(long ledgerId, WriteCallback cb,
+                            Object ctx, byte[] masterKey) {
+        if (LOG.isTraceEnabled()) {
+            LOG.trace("Forcing ledger {}", ledgerId);
+        }
+        ensureLedgerOnMasterKeyCache(ledgerId, masterKey);
 
 Review comment:
   I thought we agreed that we are not touching ledger storage at this moment 
at the slack channel. The method would be just as simple as 
`getJournal(ledgerId).forceLedger(ledgerId, cb, ctx)`, no?
   
   Image this case, if there is no entries added in the ledger, the user calls 
#force(), do you think we need to create a ledger in the ledger storage?

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