eolivelli commented on a change in pull request #889: BP-14 Implementation of 
WriteFlag.DEFERRED_SYNC on Journal
URL: https://github.com/apache/bookkeeper/pull/889#discussion_r157955300
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
 ##########
 @@ -960,6 +976,16 @@ public void run() {
                             }
                             journalFlushWatcher.reset().start();
                             bc.flush(false);
+
 
 Review comment:
   No, maybe the name 'persisted' is confusing or it is not clear the meaning.
   We have two kind of QueueEntry for writes:
   - normal (ackBeforeForce=false): the *run* method is called once, only when 
we are sure that data has been *persisted* (FileChanned forced) and after 
calling the callback we can "recycle" the object
   - deferred_sync (ackBeforeForce=true): the callback is called once, but the 
*run* method is called twice, the first time is after the *flush(false)*, the 
second time is after the entry as been *persisted* (FileChanned forced) and we 
can recycle the object after the second call.
   
   
   We are setting *persisted* = true when we are sure that the entry as really 
been persisted (forced/fsync'd), the QueueEntry object will never be used for 
this 'entry' and so we can put it in the recycler.
   Every entry always starts with *persisted* = false and then the journal sets 
persisted = true after the force().
   
   *ackBeforeForce* is a "constant" for the entry and it marks the type of 
write (deferred_sync vs normal)
   
   We have to call the *run* method twice for deferred_sync entries because at 
the first time we are firing the callback (acknowledging the write to the 
client), and at the second time we will update the cursor on the Bookie side 
which tracks which entries have been persisted durably (this is not present in 
this patch).
   If I remove the entry (or set it to *null*) from the toFlush, I call the 
callback and then recycle the entry I will never have a way to track that the 
entry has been really persisted (forced/fsync'd)

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