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

adoroszlai 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 82342c1029 HDDS-10918. NPE in OM when leader transfers (#6735)
82342c1029 is described below

commit 82342c1029cefa2d0e9061796e27d328c2abec49
Author: Sammi Chen <[email protected]>
AuthorDate: Sun Jun 2 01:19:49 2024 +0800

    HDDS-10918. NPE in OM when leader transfers (#6735)
---
 .../apache/hadoop/ozone/om/exceptions/OMNotLeaderException.java    | 7 +++++++
 .../org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java  | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/exceptions/OMNotLeaderException.java
 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/exceptions/OMNotLeaderException.java
index 1abd92b55f..91d541dcf7 100644
--- 
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/exceptions/OMNotLeaderException.java
+++ 
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/exceptions/OMNotLeaderException.java
@@ -56,6 +56,13 @@ public class OMNotLeaderException extends IOException {
     this.leaderAddress = suggestedLeaderAddress;
   }
 
+  public OMNotLeaderException(String msg) {
+    super(msg);
+    this.currentPeerId = null;
+    this.leaderPeerId = null;
+    this.leaderAddress = null;
+  }
+
   public String getSuggestedLeaderNodeId() {
     return leaderPeerId;
   }
diff --git 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java
 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java
index f09efe0d5b..7c04e39271 100644
--- 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java
+++ 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java
@@ -72,6 +72,7 @@ import org.apache.ratis.netty.NettyConfigKeys;
 import org.apache.ratis.protocol.ClientId;
 import org.apache.ratis.protocol.SetConfigurationRequest;
 import org.apache.ratis.protocol.exceptions.LeaderNotReadyException;
+import org.apache.ratis.protocol.exceptions.LeaderSteppingDownException;
 import org.apache.ratis.protocol.exceptions.NotLeaderException;
 import org.apache.ratis.protocol.exceptions.StateMachineException;
 import org.apache.ratis.protocol.Message;
@@ -495,6 +496,11 @@ public final class OzoneManagerRatisServer {
             leaderNotReadyException.getMessage()));
       }
 
+      LeaderSteppingDownException leaderSteppingDownException = 
reply.getLeaderSteppingDownException();
+      if (leaderSteppingDownException != null) {
+        throw new ServiceException(new 
OMNotLeaderException(leaderSteppingDownException.getMessage()));
+      }
+
       StateMachineException stateMachineException =
           reply.getStateMachineException();
       if (stateMachineException != null) {


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

Reply via email to