You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by yi...@apache.org on 2024/04/15 02:21:16 UTC

(ozone) branch notifyLeaderReady created (now a37ab65c28)

This is an automated email from the ASF dual-hosted git repository.

yiyang0203 pushed a change to branch notifyLeaderReady
in repository https://gitbox.apache.org/repos/asf/ozone.git


      at a37ab65c28 Change to use notifyLeaderReady

This branch includes the following new commits:

     new a37ab65c28 Change to use notifyLeaderReady

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


(ozone) 01/01: Change to use notifyLeaderReady

Posted by yi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yiyang0203 pushed a commit to branch notifyLeaderReady
in repository https://gitbox.apache.org/repos/asf/ozone.git

commit a37ab65c2885e845bd5cc830e0dee14396258f02
Author: Symious <yi...@gmail.com>
AuthorDate: Mon Apr 15 10:21:02 2024 +0800

    Change to use notifyLeaderReady
---
 .../apache/hadoop/hdds/scm/ha/SCMStateMachine.java | 41 +++++++++++-----------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java
index 9d9bf07fda..99b1de317a 100644
--- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java
+++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java
@@ -352,30 +352,31 @@ public class SCMStateMachine extends BaseStateMachine {
     if (transactionBuffer != null) {
       transactionBuffer.updateLatestTrxInfo(TransactionInfo.valueOf(term, index));
     }
+  }
 
-    if (currentLeaderTerm.get() == term) {
-      // On leader SCM once after it is ready, notify SCM services and also set
-      // leader ready  in SCMContext.
-      if (scm.getScmHAManager().getRatisServer().getDivision().getInfo()
-          .isLeaderReady()) {
-        scm.getScmContext().setLeaderReady();
-        scm.getSCMServiceManager().notifyStatusChanged();
-        scm.getFinalizationManager().onLeaderReady();
-      }
+  @Override
+  public void notifyLeaderRead() {
+    // On leader SCM once after it is ready, notify SCM services and also set
+    // leader ready  in SCMContext.
+    if (scm.getScmHAManager().getRatisServer().getDivision().getInfo()
+        .isLeaderReady()) {
+      scm.getScmContext().setLeaderReady();
+      scm.getSCMServiceManager().notifyStatusChanged();
+      scm.getFinalizationManager().onLeaderReady();
+    }
 
-      // Means all transactions before this term have been applied.
-      // This means after a restart, all pending transactions have been applied.
-      // Perform
-      // 1. Refresh Safemode rules state.
-      // 2. Start DN Rpc server.
-      if (!refreshedAfterLeaderReady.get()) {
-        scm.getScmSafeModeManager().refresh();
-        scm.getDatanodeProtocolServer().start();
+    // Means all transactions before this term have been applied.
+    // This means after a restart, all pending transactions have been applied.
+    // Perform
+    // 1. Refresh Safemode rules state.
+    // 2. Start DN Rpc server.
+    if (!refreshedAfterLeaderReady.get()) {
+      scm.getScmSafeModeManager().refresh();
+      scm.getDatanodeProtocolServer().start();
 
-        refreshedAfterLeaderReady.set(true);
-      }
-      currentLeaderTerm.set(-1L);
+      refreshedAfterLeaderReady.set(true);
     }
+    currentLeaderTerm.set(-1L);
   }
 
   @Override


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