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 07:02:21 UTC

[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.

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