sijie commented on a change in pull request #677: Issue 659: Fix Checkpoint 
logic in SortedLedgerStorage
URL: https://github.com/apache/bookkeeper/pull/677#discussion_r153377448
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/InterleavedLedgerStorage.java
 ##########
 @@ -465,6 +437,9 @@ public void onRotateEntryLog() {
         // TODO: we could consider remove checkpointSource and 
checkpointSouce#newCheckpoint
         // later if we provide kind of LSN (Log/Journal Squeuence Number)
         // mechanism when adding entry. {@link 
https://github.com/apache/bookkeeper/issues/279}
-        checkpointHolder.setNextCheckpoint(checkpointSource.newCheckpoint());
+        if (null != checkpointer) {
 
 Review comment:
   @reddycharan 
   
   the logic here is to have each ledger storage control when they want to 
checkpoint. when ledger storage wants to do checkpoint, it issues a checkpoint 
request to checkpointer to ask it starts checkpointing. the idea was originated 
when we introduced checkpoint mechanism to avoid performance penalty. This 
change was just reverting the behavior the original checkpoint mechanism I 
introduced 3 years ago, which is proven to be correct and has been running at 
Twitter production for 3 years. Hope this clarifies 2. a)
   
   the question 1 is unfortunately to be avoided (without changing a lot of 
code), if we follows the principle letting each ledger storage control when 
they want to checkpoint, because SortedLedgerStorage inherits from 
InterleavedLedgerStorage.
   
   regarding 2. b), the idea for checkpointing sorted ledger storage is we only 
checkpoint sorted ledger storage, when the interleave ledger storage moving on 
to a new entry log file (which is effectively entry log file rolling). We don't 
want to checkpoint happens on a file that memtable will potentially flushing 
entries to. That hurts performance. so in this sense, the checkpoint for sorted 
ledger storage only happens after a memtable is flushed to entry log file and 
the entry log file is rotated to a new file.
   
   The implementation here is not elegant as Ivan has raised the concerns 3 
years ago. However, it turns out this implementation provides much efficient 
and correct behavior, which has been verified in twitter production for 3 
years. I would suggest us going with this change and doing a refactor later. It 
is much safer from my experience.
   
   

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