You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/01/04 03:53:06 UTC
[GitHub] [ozone] GlenGeng commented on a change in pull request #1737: HDDS-4568. Add SCMContext to SCM HA
GlenGeng commented on a change in pull request #1737:
URL: https://github.com/apache/ozone/pull/1737#discussion_r551107014
##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java
##########
@@ -89,4 +103,27 @@ private Message process(final SCMRatisRequest request)
}
}
+ @Override
+ public void notifyNotLeader(Collection<TransactionContext> pendingEntries) {
+ LOG.info("current leader SCM steps down.");
+ scm.getScmContext().updateIsLeaderAndTerm(false, 0);
+ }
+
+ @Override
+ public void notifyLeaderChanged(RaftGroupMemberId groupMemberId,
+ RaftPeerId newLeaderId) {
+ if (!groupMemberId.getPeerId().equals(newLeaderId)) {
+ LOG.info("leader changed, yet current SCM is still follower.");
+ return;
+ }
+
+ long term = scm.getScmHAManager()
+ .getRatisServer()
+ .getDivision()
+ .getInfo()
+ .getCurrentTerm();
Review comment:
We use SCMContext to encapsulate raft related info, so that components in SCM won't need to hold a reference of SCMHAManager or SCMRatisServer.
For non-HA mode or unit test, we just need an empty SCMContext, instead of a mocked SCMHAManager or a mocked SCMRatisServer.
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org