sijie commented on a change in pull request #1281: Issue #570: Introducing EntryLogManager. URL: https://github.com/apache/bookkeeper/pull/1281#discussion_r176336283
########## File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java ########## @@ -802,88 +864,207 @@ private long readLastLogId(File f) { } } + interface EntryLogManager { + /* + * acquire lock for this ledger. + */ + void acquireLock(Long ledgerId); + + /* + * acquire lock for this ledger if it is not already available for this + * ledger then it will create a new one and then acquire lock. + */ + void acquireLockByCreatingIfRequired(Long ledgerId); + + /* + * release lock for this ledger + */ + void releaseLock(Long ledgerId); + + /* + * sets the logChannel for the given ledgerId. The previous one will be + * removed from replicaOfCurrentLogChannels. Previous logChannel will be + * added to rotatedLogChannels. + */ + void setCurrentLogForLedger(Long ledgerId, BufferedLogChannel logChannel); Review comment: All the `currentLogForLedger` `copy of rotated log channels` `copy of current logs` are kind of implementation detail of an implementation of EntryLogManager. Can we think of a better abstraction to hide these? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services