reddycharan commented on a change in pull request #1374: BP-32: Advisory (optimistic) write close URL: https://github.com/apache/bookkeeper/pull/1374#discussion_r185063785
########## File path: site/bps/BP-32-advisory-write-close.md ########## @@ -0,0 +1,54 @@ +--- +title: "BP-32: Advisory (optimistic) write close" +issue: https://github.com/apache/bookkeeper/issues/1343 +state: Under Discussion +release: N/A +--- + +### Motivation + +With entrylog per ledger feature (https://github.com/apache/bookkeeper/issues/570) there will be dedicated entrylog for each ledger and it provides EntryLogManagerForEntryLogPerLedger (EntryLogManager). Since there is going to be entrylog per ledger, with the current Bookie implementation there is no way for EntryLogManagerForEntryLogPerLedger (EntryLogManager) to know when the entrylog is writeclosed, so that entrylog for the active ledger can be rotated. So it would be ideal to have explicit call to EntryLogger when the write for this ledger is done and it is writeclosed, so that it can rotate the entrylog as soon as it is write closed. This will minimize the number of entrylogs/file descriptors that are open/active and also it will make progress in leastUnflushedLogId, so that GarbageCollectorThread can consider these entrylogs for garbage collection. + +### Proposed Changes + +So in entrylog per ledger feature implementation, as a first step of handling this, expireAfterAccess (each entrylog should be automatically rotated from the current active entrylog list once a fixed duration has elapsed after the last access of entrylog for addEntry) will be implemented and also the maximum number of entrylogs that can be active at a given time (this is for limiting number of entrylogs/filedescriptors open at a given time). + +The above mentioned approaches are preliminary ways of handling but it would be ideal to have explicit call to EntryLogger when the write for this ledger is done so that it can rotate the entrylog as soon as it is write closed. So to implement this following can be done + +- have explicit write close request. This write close request should be sent to the current ensemble when the write handle is closed. This should be just optimistic write close operation and callback of this operation should be just logger, saying if it is succeeded / partially succeeded / failed. This should be done asynchronously and the write handle close operation should not be blocked for this response. Review comment: having client config would help this. But in the case of *enforced* close, success/failure behavior should be defined 1) will we fail the writehandle close call? 2) what should be the behavior if it is partial success (part of the ensemble succeed but not the rest)? 3) In case of no response should we retry? 4) In case of writehandle close call failure, should we expect API user to retry the writeHandle close call untill it is succeeded? ---------------------------------------------------------------- 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
