rich7420 commented on code in PR #11238:
URL: https://github.com/apache/ozone/pull/11238#discussion_r4705413035


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/proxy/SCMFailoverProxyProviderBase.java:
##########
@@ -575,10 +603,12 @@ private T createSCMProxy(InetSocketAddress scmAddress) 
throws IOException {
     // retries on the same SCM in case of connection exception. This retry
     // policy essentially results in TRY_ONCE_THEN_FAIL.
     RetryPolicy connectionRetryPolicy = 
RetryPolicies.failoverOnNetworkException(0);
+    SocketFactory sockFactory = socketFactory == null ?

Review Comment:
   Could a test go through `createSCMProxy`? Ignoring the injected factory here 
still passed all 24 new tests, and `ClientCache` was back to one shared client 
with the 5s timeout.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -686,19 +688,33 @@ private OzoneManager(OzoneConfiguration conf, 
StartupOption startupOption)
     // Honor property 'hadoop.security.token.service.use_ip'
     omRpcAddressTxt = new Text(SecurityUtil.buildTokenService(omNodeRpcAddr));
 
+    scmLocationClientConfiguration =
+        OMScmLocationClientConfig.createScmClientConfiguration(configuration);
+    SocketFactory scmLocationSocketFactory =
+        OMScmLocationClientConfig.createSocketFactory(configuration);
     // Retain SCM proxy providers so OM can dynamically reload nodes/addresses 
without restarting.
     final SCMContainerLocationFailoverProxyProvider scmContainerProxyProvider =
-        new SCMContainerLocationFailoverProxyProvider(configuration, null);
+        new SCMContainerLocationFailoverProxyProvider(
+            scmLocationClientConfiguration, null, scmLocationSocketFactory);
     final StorageContainerLocationInternalInterface scmContainerClient =
-        HAUtils.getScmContainerClient(configuration, 
scmContainerProxyProvider);
+        HAUtils.getScmContainerClient(scmLocationClientConfiguration,
+            scmContainerProxyProvider);
     // verifies that the SCM info in the OM Version file is correct.
     final SCMBlockLocationFailoverProxyProvider scmBlockProxyProvider =
-        new SCMBlockLocationFailoverProxyProvider(configuration);
+        new SCMBlockLocationFailoverProxyProvider(
+            scmLocationClientConfiguration, scmLocationSocketFactory);
     final ScmBlockLocationProtocol scmBlockClient =
-        HAUtils.getScmBlockClient(configuration, scmBlockProxyProvider);
+        HAUtils.getScmBlockClient(scmLocationClientConfiguration,
+            scmBlockProxyProvider);
+    final SCMBlockLocationFailoverProxyProvider 
keyDeletionScmBlockProxyProvider =
+        new SCMBlockLocationFailoverProxyProvider(configuration);
+    final ScmBlockLocationProtocol keyDeletionScmBlockClient =
+        HAUtils.getScmBlockClient(configuration,
+            keyDeletionScmBlockProxyProvider);
     scmTopologyClient = new ScmTopologyClient(scmBlockClient);

Review Comment:
   `ScmTopologyClient` uses the fail-fast client, which gave up after ~6s with 
SCM down. A failed refresh throws out of `scheduleAtFixedRate`, so polling 
stops for good. Could it keep the tolerant client?



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -6178,7 +6194,10 @@ private String reconfScmNodes(String value) {
     String scmNodesKey = ConfUtils.addKeySuffixes(OZONE_SCM_NODES_KEY,
         HddsUtils.getScmServiceId(configuration));
     String previous = configuration.get(scmNodesKey);
+    String previousLocationClientValue =
+        scmLocationClientConfiguration.get(scmNodesKey);
     configuration.set(scmNodesKey, value);
+    scmLocationClientConfiguration.set(scmNodesKey, value);

Review Comment:
   Adding `scm4` with its address failed here (the snapshot config lacks the 
address), then left block/container providers on 4 nodes and deletion on 3. 
Could addresses be synced before this reload?



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/HAUtils.java:
##########
@@ -135,6 +136,12 @@ public static ScmBlockLocationProtocol getScmBlockClient(
         new SCMBlockLocationFailoverProxyProvider(conf));
   }
 
+  public static ScmBlockLocationProtocol getScmBlockClient(

Review Comment:
   The socket-factory `getScmBlockClient` overload has no caller, and the 3-arg 
`getScmContainerClient` is only called with a `null` factory. Could both go, 
since OM builds its own providers?



##########
hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/scm/proxy/TestSCMFailoverProxyProviderBase.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.hdds.scm.proxy;
+
+import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_ADDRESS_KEY;
+import static 
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_BLOCK_CLIENT_ADDRESS_KEY;
+import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_NODES_KEY;
+import static 
org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_SERVICE_IDS_KEY;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.io.IOException;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.ratis.ServerNotLeaderException;
+import org.apache.hadoop.ozone.ha.ConfUtils;
+import org.apache.ratis.protocol.RaftPeerId;
+import org.junit.jupiter.api.Test;
+
+/** Tests failover target selection. */
+class TestSCMFailoverProxyProviderBase {

Review Comment:
   Could `roundRobinContinuesAfterSuggestedLeaderFails` move into 
`TestSCMFailoverProxyProviderRefreshWired`? It already has 
`newThreeNodeProvider()`, `proxyInfoOf()` and `failoverWith()`, so the new 
class wouldn't be needed.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to