kgyrtkirk commented on a change in pull request #2314:
URL: https://github.com/apache/hive/pull/2314#discussion_r638863738



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -290,21 +290,9 @@
   public static final String TRUSTSTORE_PASSWORD_KEY = 
"javax.net.ssl.trustStorePassword";
   public static final String TRUSTSTORE_TYPE_KEY = 
"javax.net.ssl.trustStoreType";
 
-  private static final String HOSTNAME;
-  private static final String USER;
+  private static final String HOSTNAME = 
InetUtils.hostname(Optional.of("UNKNOWN"));

Review comment:
       old implementation was getting the ip address for some reason

##########
File path: 
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/InetUtils.java
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.hive.metastore.utils;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Objects;
+import java.util.Optional;
+
+/**
+ * Utility functions around the Java InetAddress class.
+ */
+public class InetUtils {
+
+  /**
+   * @return name of current host
+   */
+  public static String hostname() {
+    return hostname(Optional.empty());
+  }
+
+  /**
+   * @return name of current host
+   */
+  public static String hostname(Optional<String> defaultValue) {

Review comment:
       I don't see much sanity in working on a machine which doesn't have its 
hostname set up correctly...I think suppressing issues like this might just hit 
back later....
   
   I know it's not in the scope of this patch to fix this - but I think we may 
just forget those `UNKNOWN` -s instead of the hostname. What do you think?




-- 
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:
[email protected]



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

Reply via email to