adoroszlai commented on code in PR #7268:
URL: https://github.com/apache/ozone/pull/7268#discussion_r1810398889
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/ha/GrpcOMFailoverProxyProvider.java:
##########
@@ -116,9 +126,35 @@ protected void loadOMClientConfigs(ConfigurationSource
config, String omSvcId)
private T createOMProxy() throws IOException {
InetSocketAddress addr = new InetSocketAddress(0);
+ return createOmProxy(addr);
+ }
+
+ /**
+ * Get the protocol proxy for provided address.
+ * @param address An instance of {@link InetSocketAddress} which contains
the address to connect
+ * @return the proxy connection to the address and the set of methods
supported by the server at the address
+ * @throws IOException if any error occurs while trying to get the proxy
+ */
+ private T createOmProxy(InetSocketAddress address) throws IOException {
Configuration hadoopConf =
LegacyHadoopConfigurationSource.asHadoopConfiguration(getConf());
- return (T) RPC.getProxy(getInterface(), 0, addr, hadoopConf);
+
+ // TODO: Post upgrade to Protobuf 3.x we need to use ProtobufRpcEngine2
+ RPC.setProtocolEngine(hadoopConf, getInterface(), ProtobufRpcEngine.class);
+
+ // Ensure we do not attempt retry on the same OM in case of exceptions
+ RetryPolicy connectionRetryPolicy =
RetryPolicies.failoverOnNetworkException(0);
+
+ return (T) RPC.getProtocolProxy(
+ getInterface(),
+ protocolVer,
+ address,
+ ugi,
+ hadoopConf,
+ NetUtils.getDefaultSocketFactory(hadoopConf),
+ (int) OmUtils.getOMClientRpcTimeOut(getConf()),
+ connectionRetryPolicy
+ ).getProxy();
Review Comment:
This seems to be copied from `HadoopRpcOMFailoverProxyProvider`. Instead of
duplicating it, can it be pushed to the parent class
`OMFailoverProxyProviderBase`?
##########
hadoop-hdds/framework/src/test/java/org/apache/hadoop/hdds/server/TestOzoneAdminUtils.java:
##########
@@ -0,0 +1,158 @@
+/*
+ * 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.hdds.server;
+
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.ozone.OzoneConfigKeys;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * This class is to test the utilities present in the OzoneAdmins class.
+ */
+class TestOzoneAdminUtils {
Review Comment:
nit: should be `TestOzoneAdmins`
--
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]