[ https://issues.apache.org/jira/browse/RATIS-182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16309172#comment-16309172 ]
Tsz Wo Nicholas Sze commented on RATIS-182: ------------------------------------------- This may not be a bug. The state machine implementation define both writeStateMachineData and applyTransaction. It should sync these two methods internally. In the FileStore example, we use FileInfo.UnderConstruction.writeFutures to solve this problem. If we sync appendEntry(e), it will slow down all transactions even if there is no state machine data. BTW, it would great if you could provide the method names with the class names. There are many similar method names in various classes. :) > Leader should wait for the log entries to be appended and synced > ---------------------------------------------------------------- > > Key: RATIS-182 > URL: https://issues.apache.org/jira/browse/RATIS-182 > Project: Ratis > Issue Type: Bug > Reporter: Mukul Kumar Singh > Assignee: Mukul Kumar Singh > > Leader currently doesn't wait for the transaction to be appended to the log. > This can lead to a situation where {{applyTransaction}} can be called before > {{writeStateMachineData}} finishes. > {code} > public long append(long term, TransactionContext operation, > ClientId clientId, long callId) throws StateMachineException { > ... > ... > ... > appendEntry(e) <---- This should be synced > operation.setLogEntry(e); > return nextIndex; > } > } > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)