You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/06/18 10:24:18 UTC

[GitHub] [bookkeeper] hangc0276 commented on a diff in pull request #3329: Fix data lost when configured multiple ledger directories

hangc0276 commented on code in PR #3329:
URL: https://github.com/apache/bookkeeper/pull/3329#discussion_r900800828


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java:
##########
@@ -660,7 +660,7 @@ static void writePaddingBytes(JournalChannel jc, ByteBuf paddingBuffer, int jour
     // Should data be fsynced on disk before triggering the callback
     private final boolean syncData;
 
-    private final LastLogMark lastLogMark = new LastLogMark(0, 0);
+    private final LastLogMark lastLogMark = new LastLogMark(Long.MAX_VALUE, Long.MAX_VALUE);

Review Comment:
   When creating a Journal instance, it will initiate `lastLogMark` by reading each ledger directory's `lastMark` file and get the minimum position as the replay start point. So we should init lastLogMark with the MAX_VALUE.
   
   In fact, the original logic of init `lastLogMark` with 0, and get the maximum position of all the ledger directory's `lastMark` file to init the lastLogMark. IMO, it will lose data.



-- 
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: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org