hangc0276 commented on PR #3194:
URL: https://github.com/apache/bookkeeper/pull/3194#issuecomment-1189912416

   > when the bookie is restarted with replaying the journal, how to handle the 
corner cases below: 1)bookie crash with reused journal **enabled**, but the 
restart bookie with the flag **disabled**; 2)bookie crash with reused journal 
**disabled**, but the restart bookie with the flag **enabled**.
   
   @ArvinDevel Thanks for your review.
   
   Currently, we reuse the journal files by renaming the file name. 
   For example, the journal file pool size is 5, and current journal files are: 
[101, 102, 103, 104, 105], and the current mark deletion position is (103, 
2000). We need a new journal file named 106, and if we enabled the reuse 
journal file, we will do the following check.
   1) The journal files list is: [101, 102, 103, 104, 105], and the mark 
deletion position point to file: 103, it is safe to reuse file: 101
   2) We pick up file: 101 and rename it to file: 106, after rename, the 
journal files list is: [102, 103, 104, 105, 106]
   
   For the first case.
   >  1)bookie crash with reused journal **enabled**, but the restart bookie 
with the flag **disabled**
   
   Bookie crash with reused journal enabled, the last written journal file is 
106, and the last mark delete position is (103, 2000). When the bookie restarts 
with the flag disabled, it will replay from file: 103 to file 106.
   
   > 2) bookie crash with reused journal **disabled**, but the restart bookie 
with the flag **enabled**
   
   Bookie crash with reuse journal disabled, the last written journal file is 
106, and the last mark delete position is (103, 2000). When the bookie restarts 
with the flag enabled, it will replay from file 103 to file 106 and for new 
file 107 to be written, it does the above check, renames file 101 to file 107, 
and open it for writing. 
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to