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

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


The following commit(s) were added to refs/heads/master by this push:
     new 5151a5070b HDDS-10690. SCMStateMachine Override 
LeaderEventApi.notifyLeaderReady (#6529)
5151a5070b is described below

commit 5151a5070bbdb86d08b8416e54aa85cd0bcaeceb
Author: Symious <[email protected]>
AuthorDate: Tue Apr 16 04:39:42 2024 +0800

    HDDS-10690. SCMStateMachine Override LeaderEventApi.notifyLeaderReady 
(#6529)
---
 .../apache/hadoop/hdds/scm/ha/SCMStateMachine.java  | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 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..7eab815446 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
@@ -354,15 +354,6 @@ public class SCMStateMachine extends BaseStateMachine {
     }
 
     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();
-      }
-
       // Means all transactions before this term have been applied.
       // This means after a restart, all pending transactions have been 
applied.
       // Perform
@@ -378,6 +369,18 @@ public class SCMStateMachine extends BaseStateMachine {
     }
   }
 
+  @Override
+  public void notifyLeaderReady() {
+    if (!isInitialized) {
+      return;
+    }
+    // On leader SCM once after it is ready, notify SCM services and also set
+    // leader ready  in SCMContext.
+    scm.getScmContext().setLeaderReady();
+    scm.getSCMServiceManager().notifyStatusChanged();
+    scm.getFinalizationManager().onLeaderReady();
+  }
+
   @Override
   public void notifyConfigurationChanged(long term, long index,
       RaftProtos.RaftConfigurationProto newRaftConfiguration) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to