You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/07/14 11:55:07 UTC
[GitHub] [incubator-ratis] GlenGeng edited a comment on pull request #151: RATIS-1001: add currentTerm to LeaderInfoProto for supporting SCM-HA.
GlenGeng edited a comment on pull request #151:
URL: https://github.com/apache/incubator-ratis/pull/151#issuecomment-658137005
@lokeshj1703
The concern here is we need consider the atomicity of reading role and reading term.
For leader case, `LeaderState` has its member `private final long currentTerm;`, which is read only, meanwhile `RoleInfo` has its member `AtomicReference<LeaderState> leaderState`, which is an atomic variable, thus current `getRoleInfoProto()` can ensure the atomicity of reading role and reading term together.
But for candidate and follower, if we want to ensure of same atomicity, we need lock entire `RaftServerImpl`, reading role and call `getState().getCurrentTerm()`. But I didn't see the requirement of return candidate and follower with its term.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org