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 2020/12/25 22:55:54 UTC

[GitHub] [ozone] amaliujia commented on a change in pull request #1737: HDDS-4568. Add SCMContext to SCM HA

amaliujia commented on a change in pull request #1737:
URL: https://github.com/apache/ozone/pull/1737#discussion_r548918760



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java
##########
@@ -516,6 +515,15 @@ public RaftServer getServer() {
     return server;
   }
 
+  public RaftServer.Division getServerDivision() throws IOException {

Review comment:
       This part of a change is contained in master (https://github.com/apache/ozone/pull/1728)

##########
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:
       Will it make sense to use SCMContext to get current 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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org