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 1f9f4cc7918 HDDS-17320. SCM client does not recognize
RetriableWithNoFailoverException returned by SCM (#11698)
1f9f4cc7918 is described below
commit 1f9f4cc7918e9c2ef1364b84e04f90289b883c8e
Author: Siyao Meng <[email protected]>
AuthorDate: Fri Oct 23 22:44:05 2026 -0700
HDDS-17320. SCM client does not recognize RetriableWithNoFailoverException
returned by SCM (#11698)
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../scm/ha/RetriableWithNoFailoverException.java | 10 ++++++++++
.../apache/hadoop/hdds/scm/ha/TestSCMHAUtils.java | 22 ++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/RetriableWithNoFailoverException.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/RetriableWithNoFailoverException.java
index ab4a1fff239..7b096f7d3f9 100644
---
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/RetriableWithNoFailoverException.java
+++
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ha/RetriableWithNoFailoverException.java
@@ -24,6 +24,16 @@
* same server, without failover.
*/
public class RetriableWithNoFailoverException extends IOException {
+
+ /**
+ * Constructs a {@code RetriableWithNoFailoverException} with the given
detailed message. <p>
+ * Required for Unwrapping {@code RemoteException}. Used by
+ * {@link org.apache.hadoop.ipc_.RemoteException#unwrapRemoteException()}
+ */
+ public RetriableWithNoFailoverException(String message) {
+ super(message);
+ }
+
public RetriableWithNoFailoverException(IOException exception) {
super(exception);
}
diff --git
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/scm/ha/TestSCMHAUtils.java
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/scm/ha/TestSCMHAUtils.java
index 091fbc7a9ad..863f1185c8e 100644
---
a/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/scm/ha/TestSCMHAUtils.java
+++
b/hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/scm/ha/TestSCMHAUtils.java
@@ -23,10 +23,16 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import com.google.protobuf.ServiceException;
+import java.io.IOException;
import java.util.Collection;
import org.apache.hadoop.hdds.HddsUtils;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.scm.ha.RetriableWithNoFailoverException;
import org.apache.hadoop.hdds.scm.ha.SCMHAUtils;
+import org.apache.hadoop.io.retry.RetryPolicy.RetryAction;
+import org.apache.hadoop.io.retry.RetryPolicy.RetryAction.RetryDecision;
+import org.apache.hadoop.ipc_.RemoteException;
import org.junit.jupiter.api.Test;
/**
@@ -51,4 +57,20 @@ void testRemoveSelfId() {
assertEquals(2, nodesWithoutSelf.size());
assertThat(nodesWithoutSelf).doesNotContain(selfId);
}
+
+ @Test
+ void retriesSameScmOnRetriableWithNoFailoverException() {
+ Exception e = new ServiceException(new
RemoteException(RetriableWithNoFailoverException.class.getName(),
+ "SCM leader is not ready"));
+ assertThat(SCMHAUtils.checkRetriableWithNoFailoverException(e)).isTrue();
+ RetryAction action = SCMHAUtils.getRetryAction(0, 0, e, 15, 2000);
+ assertEquals(RetryDecision.RETRY, action.action);
+ assertEquals(2000, action.delayMillis);
+ // Fails after max retries
+ assertEquals(RetryDecision.FAIL, SCMHAUtils.getRetryAction(0, 15, e, 15,
2000).action);
+
+ // Other exceptions are not matched
+ Exception other = new ServiceException(new
RemoteException(IOException.class.getName(), "error"));
+
assertThat(SCMHAUtils.checkRetriableWithNoFailoverException(other)).isFalse();
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]