[ 
https://issues.apache.org/jira/browse/BOOKKEEPER-685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13768983#comment-13768983
 ] 

Sijie Guo commented on BOOKKEEPER-685:
--------------------------------------

{quote}
Out of interest, why don't you want to notify the offset? 
{quote}

notifying offset doesn't help. the core part of 
EntryLogListener#onRotateEntryLog is that bookie should not checkpoint/flush 
current entry log. notifying offset doesn't (and should not) change this 
behavior, so GC thread still needs to wait until entry logger rotated to next 
file then do flushing.

#onRotateEntryLog is not a good name for 4.2 branch. since in the 4.2 patch for 
BOOKKEEPER-664, onRotateEntryLog actually means entry logger file is flushed, 
so you don't need to call EntryLogger#flush in GCThread.

But in trunk, onRotateEntryLog just means that entry logger file is rotated, 
which doesn't mean that entry logger is flushed. so GCThread needs to call 
EntryLogger#checkpoint to flush the previous entry log files before flushing 
ledger cache. 


                
> Race in compaction algorithm from BOOKKEEPER-664
> ------------------------------------------------
>
>                 Key: BOOKKEEPER-685
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-685
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>            Priority: Blocker
>             Fix For: 4.2.2
>
>
> I discovered a race in the algorithm when I was forward porting to trunk.
> 1) Thread1: flushed.set(false)
> 2) Thread2: onRotateEntryLog() // flushed.set(true)
> 3) Thread1: entryLogger addEntry L123-E456
> 4) Thread1: offsets > max, waits for flushed, flushed is true(as set in 2), 
> L123-E456 updated in ledger cache
> 5) T2: L123 flushed out of ledger cache
> 6) Crash
> This will possible lose 1 entry. I've only reasoned this, not observed it, 
> but it can happen.
> The fix is pretty easy. EntryLoggerListener should notify with the point 
> offset in the entry log it has synced as far as. 
>       

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to