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/04/23 01:42:09 UTC

[GitHub] [hadoop-ozone] umamaheswararao opened a new pull request #859: HDDS-3465. OM Failover retry happens too quickly when new leader suggested and retrying on same OM.

umamaheswararao opened a new pull request #859:
URL: https://github.com/apache/hadoop-ozone/pull/859


   
   ## What changes were proposed in this pull request?
   
   When leader was suggested, we are updating lastAttemptedOMid correctly, so that waitTime can be calculated by incrementing if failover to same OM.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-3465
   
   ## How was this patch tested?
   Added 2 tests which reproduce the case and after fix, they both passed.
   


----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] hanishakoneru commented on a change in pull request #859: HDDS-3465. OM Failover retry happens too quickly when new leader suggested and retrying on same OM.

Posted by GitBox <gi...@apache.org>.
hanishakoneru commented on a change in pull request #859:
URL: https://github.com/apache/hadoop-ozone/pull/859#discussion_r414831758



##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/OMFailoverProxyProvider.java
##########
@@ -318,9 +318,12 @@ synchronized boolean updateLeaderOMNodeId(String newLeaderOMNodeId) {
     if (!currentProxyOMNodeId.equals(newLeaderOMNodeId)) {
       if (omProxies.containsKey(newLeaderOMNodeId)) {
         currentProxyOMNodeId = newLeaderOMNodeId;
+        lastAttemptedOM = currentProxyOMNodeId;

Review comment:
       We are updating lastAttemptedOM to the new OM which will be tried after failover. The assignment should happen before the currentProxyOMNodeId is updated with newLeaderOMNodeId.




----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] hanishakoneru commented on pull request #859: HDDS-3465. OM Failover retry happens too quickly when new leader suggested and retrying on same OM.

Posted by GitBox <gi...@apache.org>.
hanishakoneru commented on pull request #859:
URL: https://github.com/apache/hadoop-ozone/pull/859#issuecomment-619286092


   Thanks Uma for working on this. 
   LGTM. +1.


----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] umamaheswararao commented on a change in pull request #859: HDDS-3465. OM Failover retry happens too quickly when new leader suggested and retrying on same OM.

Posted by GitBox <gi...@apache.org>.
umamaheswararao commented on a change in pull request #859:
URL: https://github.com/apache/hadoop-ozone/pull/859#discussion_r414169164



##########
File path: hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/ha/TestOMFailoverProxyProvider.java
##########
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.om.ha;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.ozone.OmUtils;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_NODES_KEY;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.
+    OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_KEY;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.
+    OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_DEFAULT;
+
+/**
+ * Test OMFailoverProxyProvider failover behaviour.
+ */
+public class TestOMFailoverProxyProvider {
+  private final static String OM_SERVICE_ID = "om-service-test1";
+  private final static String NODE_ID_BASE_STR = "omNode-";
+  private final static String DUMMY_NODE_ADDR = "0.0.0.0:8080";
+
+  /**
+   * 1. Create FailoverProvider with 3 OMs.
+   * 2. Try failover to different node: WaitTime should be 0.
+   * 3. Try failover to same node: wiatTime should increment
+   * attempts*waitBetweenRetries
+   */
+  @Test
+  public void testWaitTimeWithSameNodeFailover() throws IOException {

Review comment:
       @adoroszlai , Thank you for reviews. I have refactored tests and added few more cases. Please take a look at it.




----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] umamaheswararao commented on a change in pull request #859: HDDS-3465. OM Failover retry happens too quickly when new leader suggested and retrying on same OM.

Posted by GitBox <gi...@apache.org>.
umamaheswararao commented on a change in pull request #859:
URL: https://github.com/apache/hadoop-ozone/pull/859#discussion_r414880194



##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/OMFailoverProxyProvider.java
##########
@@ -318,9 +318,12 @@ synchronized boolean updateLeaderOMNodeId(String newLeaderOMNodeId) {
     if (!currentProxyOMNodeId.equals(newLeaderOMNodeId)) {
       if (omProxies.containsKey(newLeaderOMNodeId)) {
         currentProxyOMNodeId = newLeaderOMNodeId;
+        lastAttemptedOM = currentProxyOMNodeId;

Review comment:
       @hanishakoneru good catch. I added new test to cover this case too. Please take a look at it. 




----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] umamaheswararao commented on a change in pull request #859: HDDS-3465. OM Failover retry happens too quickly when new leader suggested and retrying on same OM.

Posted by GitBox <gi...@apache.org>.
umamaheswararao commented on a change in pull request #859:
URL: https://github.com/apache/hadoop-ozone/pull/859#discussion_r414392856



##########
File path: hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/ha/TestOMFailoverProxyProvider.java
##########
@@ -0,0 +1,155 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.om.ha;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.StringJoiner;
+
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.ozone.OmUtils;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_NODES_KEY;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.
+    OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_KEY;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.
+    OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_DEFAULT;
+
+/**
+ * Tests OMFailoverProxyProvider failover behaviour.
+ */
+public class TestOMFailoverProxyProvider {
+  private final static String OM_SERVICE_ID = "om-service-test1";
+  private final static String NODE_ID_BASE_STR = "omNode-";
+  private final static String DUMMY_NODE_ADDR = "0.0.0.0:8080";
+  private OMFailoverProxyProvider provider;
+  private long waitBetweenRetries;
+
+  @Before
+  public void init() throws Exception {
+    OzoneConfiguration config = new OzoneConfiguration();
+    long numNodes = 3;

Review comment:
       Hay Attila, Thanks for reviews. It make sense to make it member variable. I remember I extracted it for the purpose and lost that. BTW, that variable should be int, not long. Just updated that too.
   Take a look.
   And the pr test failures seems unrelated, I had a quick look. 




----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #859: HDDS-3465. OM Failover retry happens too quickly when new leader suggested and retrying on same OM.

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #859:
URL: https://github.com/apache/hadoop-ozone/pull/859#discussion_r414329670



##########
File path: hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/ha/TestOMFailoverProxyProvider.java
##########
@@ -0,0 +1,155 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.om.ha;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.StringJoiner;
+
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.ozone.OmUtils;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_NODES_KEY;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.
+    OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_KEY;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.
+    OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_DEFAULT;
+
+/**
+ * Tests OMFailoverProxyProvider failover behaviour.
+ */
+public class TestOMFailoverProxyProvider {
+  private final static String OM_SERVICE_ID = "om-service-test1";
+  private final static String NODE_ID_BASE_STR = "omNode-";
+  private final static String DUMMY_NODE_ADDR = "0.0.0.0:8080";
+  private OMFailoverProxyProvider provider;
+  private long waitBetweenRetries;
+
+  @Before
+  public void init() throws Exception {
+    OzoneConfiguration config = new OzoneConfiguration();
+    long numNodes = 3;

Review comment:
       A couple of test cases depend on this value by attempting 2 failovers to next node.  I think it should be a member variable and tests should use `failoverToNextNode(numNodes - 1, 0)` instead of `failoverToNextNode(2, 0)`.
   
   Note that `failoverToSameNode(2)` should be kept as is, since in that case the failover number is arbitrary.

##########
File path: hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/ha/TestOMFailoverProxyProvider.java
##########
@@ -0,0 +1,155 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.om.ha;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.StringJoiner;
+
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.ozone.OmUtils;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_NODES_KEY;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.
+    OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_KEY;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.
+    OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_DEFAULT;
+
+/**
+ * Tests OMFailoverProxyProvider failover behaviour.
+ */
+public class TestOMFailoverProxyProvider {
+  private final static String OM_SERVICE_ID = "om-service-test1";
+  private final static String NODE_ID_BASE_STR = "omNode-";
+  private final static String DUMMY_NODE_ADDR = "0.0.0.0:8080";
+  private OMFailoverProxyProvider provider;
+  private long waitBetweenRetries;
+
+  @Before
+  public void init() throws Exception {
+    OzoneConfiguration config = new OzoneConfiguration();
+    long numNodes = 3;
+    waitBetweenRetries = config.getLong(
+        OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_KEY,
+        OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_DEFAULT);
+    StringJoiner allNodeIds = new StringJoiner(",");
+    for (int i = 1; i <= numNodes; i++) {
+      String nodeId = NODE_ID_BASE_STR + i;
+      config.set(OmUtils.addKeySuffixes(OZONE_OM_ADDRESS_KEY, OM_SERVICE_ID,
+          nodeId), DUMMY_NODE_ADDR);
+      allNodeIds.add(nodeId);
+    }
+    config.set(OmUtils.addKeySuffixes(OZONE_OM_NODES_KEY, OM_SERVICE_ID),
+        allNodeIds.toString());
+    provider = new OMFailoverProxyProvider(config,
+        UserGroupInformation.getCurrentUser(), OM_SERVICE_ID);
+  }
+
+  /**
+   * Tests waitTime when fail over to next node.
+   */
+  @Test
+  public void testWaitTimeWithNextNode() {
+    failoverToNextNode(2, 0);
+    // After 3 attempts done, wait time should be waitBetweenRetries.
+    failoverToNextNode(1, waitBetweenRetries);
+    // From 4th Attempt waitTime should reset to 0.
+    failoverToNextNode(2, 0);
+    // After 2nd round of 3attempts done, wait time should be
+    // waitBetweenRetries.
+    failoverToNextNode(1, waitBetweenRetries);
+  }
+
+  /**
+   * 1. Try failover to same node: wiatTime should increment
+   * attempts*waitBetweenRetries.
+   * 2. Try failover to next node: waitTime should be 0.
+   */
+  @Test
+  public void testWaitTimeWithSameNodeFailover() {
+    // Failover attempt 1 to same OM, waitTime should increase.
+    failoverToSameNode(4);
+    // 2 same node failovers, waitTime should be 0.
+    failoverToNextNode(2, 0);
+  }

Review comment:
       It seems this is basically the same test case as `testWaitTimeResetWhenNextNodeFailoverAfterSameNode`.  If you agree, I think we can drop this one.




----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] adoroszlai commented on a change in pull request #859: HDDS-3465. OM Failover retry happens too quickly when new leader suggested and retrying on same OM.

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #859:
URL: https://github.com/apache/hadoop-ozone/pull/859#discussion_r413558213



##########
File path: hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/ha/TestOMFailoverProxyProvider.java
##########
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.om.ha;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.ozone.OmUtils;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_NODES_KEY;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.
+    OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_KEY;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.
+    OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_DEFAULT;
+
+/**
+ * Test OMFailoverProxyProvider failover behaviour.
+ */
+public class TestOMFailoverProxyProvider {
+  private final static String OM_SERVICE_ID = "om-service-test1";
+  private final static String NODE_ID_BASE_STR = "omNode-";
+  private final static String DUMMY_NODE_ADDR = "0.0.0.0:8080";
+
+  /**
+   * 1. Create FailoverProvider with 3 OMs.
+   * 2. Try failover to different node: WaitTime should be 0.
+   * 3. Try failover to same node: wiatTime should increment
+   * attempts*waitBetweenRetries
+   */
+  @Test
+  public void testWaitTimeWithSameNodeFailover() throws IOException {

Review comment:
       This method tests wait time with both same node and other node failover.  I think these should be separate test cases, both for independence and to match test method name.

##########
File path: hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/ha/TestOMFailoverProxyProvider.java
##########
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.om.ha;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.hadoop.ozone.OmUtils;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
+import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_NODES_KEY;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.
+    OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_KEY;
+import static org.apache.hadoop.ozone.OzoneConfigKeys.
+    OZONE_CLIENT_WAIT_BETWEEN_RETRIES_MILLIS_DEFAULT;
+
+/**
+ * Test OMFailoverProxyProvider failover behaviour.
+ */
+public class TestOMFailoverProxyProvider {
+  private final static String OM_SERVICE_ID = "om-service-test1";
+  private final static String NODE_ID_BASE_STR = "omNode-";
+  private final static String DUMMY_NODE_ADDR = "0.0.0.0:8080";
+
+  /**
+   * 1. Create FailoverProvider with 3 OMs.
+   * 2. Try failover to different node: WaitTime should be 0.
+   * 3. Try failover to same node: wiatTime should increment
+   * attempts*waitBetweenRetries
+   */
+  @Test
+  public void testWaitTimeWithSameNodeFailover() throws IOException {
+    String nodeId1 = NODE_ID_BASE_STR + 1;
+    String nodeId2 = NODE_ID_BASE_STR + 2;
+    String nodeId3 = NODE_ID_BASE_STR + 3;
+    OzoneConfiguration config = new OzoneConfiguration();
+    config.set(OmUtils.addKeySuffixes(OZONE_OM_NODES_KEY, OM_SERVICE_ID),
+        String.join(",", nodeId1, nodeId2, nodeId3));
+    config.set(OmUtils.addKeySuffixes(OZONE_OM_ADDRESS_KEY, OM_SERVICE_ID,
+        nodeId1), DUMMY_NODE_ADDR);
+    config.set(OmUtils.addKeySuffixes(OZONE_OM_ADDRESS_KEY, OM_SERVICE_ID,
+        nodeId2), DUMMY_NODE_ADDR);
+    config.set(OmUtils.addKeySuffixes(OZONE_OM_ADDRESS_KEY, OM_SERVICE_ID,
+        nodeId3), DUMMY_NODE_ADDR);

Review comment:
       Would be nice to avoid duplication by setting up nodes in a loop (and preferably in a helper method).




----------------------------------------------------------------
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: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org