[ https://issues.apache.org/jira/browse/RATIS-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16641011#comment-16641011 ]
Jitendra Nath Pandey commented on RATIS-337: -------------------------------------------- We still have the synchronization block in most of the places where state is being modified or checkLeaderState is used, this change may not be needed if we make checkLeaderState synchronized. Do you see major perf impact if checkLeaderState is synchronized in RaftServerImpl? {quote}// TODO: make sure that StateMachineUpdater has applied all transactions that have context {quote} As long as commit-index is updated, this will happen in the background, is this really needed at shutting down of leader thread? {quote}private static ServerRpcProto getServerRpcProto(RaftPeer peer, long delay) {quote} This method doesn't need to be static. > In RaftServerImpl, leaderState/heartbeatMonitor may be accessed without > proper null check > ----------------------------------------------------------------------------------------- > > Key: RATIS-337 > URL: https://issues.apache.org/jira/browse/RATIS-337 > Project: Ratis > Issue Type: Bug > Components: server > Reporter: Tsz Wo Nicholas Sze > Assignee: Tsz Wo Nicholas Sze > Priority: Major > Attachments: r337_20181007.patch > > > leaderState/heartbeatMonitor is declared as volatile. Some code like below > won't work since leaderState may be set to null in between. > {code:java} > //RaftServerImpl.checkLeaderState(..) > } else if (leaderState == null || !leaderState.isReady()) { > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)