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 2021/08/23 14:51:09 UTC

[GitHub] [ozone] bharatviswa504 commented on a change in pull request #2491: HDDS-5534. Verify config is updated on all OMs before proceeding with Bootstrap

bharatviswa504 commented on a change in pull request #2491:
URL: https://github.com/apache/ozone/pull/2491#discussion_r693659646



##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OMNodeDetails.java
##########
@@ -164,39 +166,80 @@ public String getOMDBCheckpointEnpointUrl(boolean isHttpPolicy) {
     return null;
   }
 
+  public String getOMPrintInfo() {
+    return getNodeId() + ":" + getHostAddress();
+  }
+
   public static OMNodeDetails getOMNodeDetailsFromConf(OzoneConfiguration conf,
       String omServiceId, String omNodeId) {
+    return getOMNodeDetailsFromConf(conf, omServiceId, omNodeId, true);
+  }
+
+  public static OMNodeDetails getOMNodeDetailsFromConf(OzoneConfiguration conf,
+      String omServiceId, String omNodeId, boolean shouldResolveAddr) {
+
     String rpcAddrKey = ConfUtils.addKeySuffixes(OZONE_OM_ADDRESS_KEY,
         omServiceId, omNodeId);
     String rpcAddrStr = OmUtils.getOmRpcAddress(conf, rpcAddrKey);
     if (rpcAddrStr == null || rpcAddrStr.isEmpty()) {
       return null;
     }
 
+    String hostAddr;
+    InetSocketAddress omRpcAddress = null;
+    int rpcPort = 0;
+    if (shouldResolveAddr) {

Review comment:
       Curious why do we need this shouldResolveAddr
   If it is incorrect config should nt we throw exception like before?

##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java
##########
@@ -697,4 +701,51 @@ public static String normalizeKey(String keyName,
     }
     return omHosts;
   }
+
+  /**
+   * Get a list of all OM details (address and ports) from the specified config.
+   */
+  public static List<OMNodeDetails> getAllOMAddresses(OzoneConfiguration conf,
+      String omServiceId, String currentOMNodeId) {
+
+    List<OMNodeDetails> omNodesList = new ArrayList<>();
+    Collection<String> omNodeIds = OmUtils.getOMNodeIds(conf, omServiceId);
+
+    String rpcAddrKey, rpcAddrStr, hostAddr, httpAddr, httpsAddr;
+    int rpcPort, ratisPort;
+    if (omNodeIds.size() == 0) {
+      //Check if it is non-HA cluster
+      rpcAddrKey = ConfUtils.addKeySuffixes(OZONE_OM_ADDRESS_KEY);

Review comment:
       Minor NIT: Here we donot require addKeySuffixes, as we are not adding any, and directly pass OZONE_OM_ADDRESS_KEY to OmUtils.getOmRpcAddress

##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocol/OMMetadata.java
##########
@@ -0,0 +1,77 @@
+/**
+ * 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.protocol;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.hadoop.ozone.om.helpers.OMNodeDetails;
+
+/**
+ * Class storing the OM metadata such as the node details in memory and node
+ * details when config is reloaded from disk.
+ * Note that this class is used as a structure to transfer the OM node
+ * information through the {@link OMMetadataProtocol} and not for storing the
+ * metadata information in OzoneManager itself.
+ */
+public final class OMMetadata {

Review comment:
       Suggestion: Instead of calling this OM Metadata can we call something like OMNodeDetailsData/OMNodeInfo to be clear? 

##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OMMetadataProtocolClientSideImpl.java
##########
@@ -0,0 +1,128 @@
+/**
+ * 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.protocolPB;
+
+import com.google.protobuf.RpcController;
+import com.google.protobuf.ServiceException;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.concurrent.TimeUnit;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hdds.conf.ConfigurationSource;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.utils.LegacyHadoopConfigurationSource;
+import org.apache.hadoop.io.retry.RetryPolicies;
+import org.apache.hadoop.io.retry.RetryPolicy;
+import org.apache.hadoop.io.retry.RetryProxy;
+import org.apache.hadoop.ipc.ProtobufRpcEngine;
+import org.apache.hadoop.ipc.RPC;
+import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.ozone.OmUtils;
+import org.apache.hadoop.ozone.om.helpers.OMNodeDetails;
+import org.apache.hadoop.ozone.om.protocol.OMMetadata;
+import org.apache.hadoop.ozone.om.protocol.OMMetadataProtocol;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerMetadataProtocolProtos.OMMetadataInfoRequest;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerMetadataProtocolProtos.OMMetadataInfoResponse;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerMetadataProtocolProtos.OMNodeInfo;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Protocol implementation for getting OM metadata information.
+ */
+public class OMMetadataProtocolClientSideImpl implements
+    OMMetadataProtocol {
+
+  /**
+   * RpcController is not used and hence is set to null.
+   */
+  private static final RpcController NULL_RPC_CONTROLLER = null;
+
+  private static final Logger LOG =
+      LoggerFactory.getLogger(OMMetadataProtocolClientSideImpl.class);
+
+  private final String omNodeID;
+  private final OMMetadataProtocolPB rpcProxy;
+
+  public OMMetadataProtocolClientSideImpl(ConfigurationSource conf,
+      UserGroupInformation ugi, String omNodeId, InetSocketAddress omAddress)
+      throws IOException {
+
+    RPC.setProtocolEngine(OzoneConfiguration.of(conf),
+        OMInterServiceProtocolPB.class, ProtobufRpcEngine.class);
+
+    this.omNodeID = omNodeId;
+
+    // OM metadata is requested from a specific OM and hence there is no need
+    // of any failover provider.
+    RetryPolicy connectionRetryPolicy = RetryPolicies
+        .failoverOnNetworkException(0);

Review comment:
       Do we want to retry on network errors for network flakiness or restarts happening

##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocol/OMMetadataProtocol.java
##########
@@ -0,0 +1,36 @@
+/**
+ * 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.protocol;
+
+import java.io.Closeable;
+import java.io.IOException;
+import org.apache.hadoop.ozone.om.OMConfigKeys;
+import org.apache.hadoop.security.KerberosInfo;
+
+/**
+ * Protocol for retrieving OM metadata information.
+ */
+@KerberosInfo(
+    serverPrincipal = OMConfigKeys.OZONE_OM_KERBEROS_PRINCIPAL_KEY)
+public interface OMMetadataProtocol extends Closeable {

Review comment:
       Suggestion/Discussion point: Same here can we rename something to OMConfigProtocol

##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OMMetadataProtocolClientSideImpl.java
##########
@@ -0,0 +1,128 @@
+/**
+ * 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.protocolPB;
+
+import com.google.protobuf.RpcController;
+import com.google.protobuf.ServiceException;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.concurrent.TimeUnit;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hdds.conf.ConfigurationSource;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.utils.LegacyHadoopConfigurationSource;
+import org.apache.hadoop.io.retry.RetryPolicies;
+import org.apache.hadoop.io.retry.RetryPolicy;
+import org.apache.hadoop.io.retry.RetryProxy;
+import org.apache.hadoop.ipc.ProtobufRpcEngine;
+import org.apache.hadoop.ipc.RPC;
+import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.ozone.OmUtils;
+import org.apache.hadoop.ozone.om.helpers.OMNodeDetails;
+import org.apache.hadoop.ozone.om.protocol.OMMetadata;
+import org.apache.hadoop.ozone.om.protocol.OMMetadataProtocol;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerMetadataProtocolProtos.OMMetadataInfoRequest;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerMetadataProtocolProtos.OMMetadataInfoResponse;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerMetadataProtocolProtos.OMNodeInfo;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Protocol implementation for getting OM metadata information.
+ */
+public class OMMetadataProtocolClientSideImpl implements
+    OMMetadataProtocol {
+
+  /**
+   * RpcController is not used and hence is set to null.
+   */
+  private static final RpcController NULL_RPC_CONTROLLER = null;
+
+  private static final Logger LOG =
+      LoggerFactory.getLogger(OMMetadataProtocolClientSideImpl.class);
+
+  private final String omNodeID;
+  private final OMMetadataProtocolPB rpcProxy;
+
+  public OMMetadataProtocolClientSideImpl(ConfigurationSource conf,
+      UserGroupInformation ugi, String omNodeId, InetSocketAddress omAddress)
+      throws IOException {
+
+    RPC.setProtocolEngine(OzoneConfiguration.of(conf),
+        OMInterServiceProtocolPB.class, ProtobufRpcEngine.class);

Review comment:
       OMInterServiceProtocolPB -> OMMetadataProtocolPB

##########
File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocol/OMMetadata.java
##########
@@ -0,0 +1,77 @@
+/**
+ * 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.protocol;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.hadoop.ozone.om.helpers.OMNodeDetails;
+
+/**
+ * Class storing the OM metadata such as the node details in memory and node
+ * details when config is reloaded from disk.
+ * Note that this class is used as a structure to transfer the OM node
+ * information through the {@link OMMetadataProtocol} and not for storing the
+ * metadata information in OzoneManager itself.
+ */
+public final class OMMetadata {
+
+  // OM nodes present in OM's memory
+  private List<OMNodeDetails> omNodesInMemory = new ArrayList<>();
+  // OM nodes reloaded from new config on disk
+  private List<OMNodeDetails> omNodesInNewConf = new ArrayList<>();
+
+  private OMMetadata(List<OMNodeDetails> inMemoryNodeList,
+      List<OMNodeDetails> onDiskNodeList) {
+    if (inMemoryNodeList != null) {

Review comment:
       Minor:
   We do-not require not null check here, as Builder has initialized to a ArrayList.




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org