diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java index 459af5b388..f5aa947bd2 100644 --- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java +++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java @@ -70,7 +70,6 @@ import org.apache.hadoop.hive.metastore.utils.JavaUtils; import org.apache.hadoop.hive.metastore.utils.MetaStoreUtils; import org.apache.hadoop.hive.metastore.utils.SecurityUtils; -import org.apache.hadoop.hive.metastore.utils.LogUtils; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.util.ReflectionUtils; import org.apache.hadoop.util.StringUtils; @@ -383,7 +382,7 @@ synchronized private URIResolverHook loadUriResolverHook() throws IllegalStateEx JavaUtils.getClassLoader()); return (URIResolverHook) ReflectionUtils.newInstance(uriResolverClass, null); } catch (Exception e) { - LOG.error("Exception loading uri resolver hook" + e); + LOG.error("Exception loading uri resolver hook: " + e); return null; } } @@ -429,8 +428,7 @@ public boolean isCompatibleWith(Configuration conf) { String newVar = MetastoreConf.getAsString(conf, oneVar); if (oldVar == null || (oneVar.isCaseSensitive() ? !oldVar.equals(newVar) : !oldVar.equalsIgnoreCase(newVar))) { - LOG.info("Mestastore configuration " + oneVar.toString() + - " changed from " + oldVar + " to " + newVar); + LOG.info("Mestastore configuration " + oneVar + " changed from " + oldVar + " to " + newVar); compatible = false; } } @@ -446,8 +444,8 @@ public void setHiveAddedJars(String addedJars) { public void reconnect() throws MetaException { if (localMetaStore) { // For direct DB connections we don't yet support reestablishing connections. - throw new MetaException("For direct MetaStore DB connections, we don't support retries" + - " at the client level."); + throw new MetaException( + "For direct MetaStore DB connections, retries are not supported at the client level"); } else { close(); @@ -566,14 +564,14 @@ private void open() throws MetaException { for (int attempt = 0; !isConnected && attempt < retries; ++attempt) { for (URI store : metastoreUris) { - LOG.info("Trying to connect to metastore with URI (" + store + ")"); + LOG.info("Trying to connect to metastore with URI ({})", store); try { if (useSSL) { try { String trustStorePath = MetastoreConf.getVar(conf, ConfVars.SSL_TRUSTSTORE_PATH).trim(); if (trustStorePath.isEmpty()) { - throw new IllegalArgumentException(ConfVars.SSL_TRUSTSTORE_PATH.toString() + throw new IllegalArgumentException(ConfVars.SSL_TRUSTSTORE_PATH + " Not configured for SSL connection"); } String trustStorePassword = @@ -582,10 +580,10 @@ private void open() throws MetaException { // Create an SSL socket and connect transport = SecurityUtils.getSSLSocket(store.getHost(), store.getPort(), clientSocketTimeout, trustStorePath, trustStorePassword); - LOG.debug("Opened an SSL connection to metastore, current connections: " + connCount.incrementAndGet()); + final int connectionCount = connCount.incrementAndGet(); + LOG.debug("Opened an SSL connection to metastore, current connections: {}", connectionCount); if (LOG.isTraceEnabled()) { - LOG.trace("", new LogUtils.StackTraceLogger("METASTORE SSL CONNECTION TRACE - open - " + - System.identityHashCode(this))); + LOG.trace("METASTORE SSL CONNECTION TRACE - open {}", System.identityHashCode(this), new Exception()); } } catch (IOException e) { throw new IllegalArgumentException(e); @@ -673,21 +671,17 @@ private void open() throws MetaException { try { if (!transport.isOpen()) { transport.open(); - LOG.info("Opened a connection to metastore, URI (" + store + ") current connections: " + connCount.incrementAndGet()); + final int connectionCount = connCount.incrementAndGet(); + LOG.info("Opened a connection to metastore, URI ({}) current connections: {}", store, connectionCount); if (LOG.isTraceEnabled()) { - LOG.trace("", new LogUtils.StackTraceLogger("METASTORE CONNECTION TRACE - open - " + - System.identityHashCode(this))); + LOG.trace("METASTORE CONNECTION TRACE - open - {}", System.identityHashCode(this), new Exception()); } } isConnected = true; } catch (TTransportException e) { tte = e; - if (LOG.isDebugEnabled()) { - LOG.warn("Failed to connect to the MetaStore Server URI (" + store + ")", e); - } else { - // Don't print full exception trace if DEBUG is not on. - LOG.warn("Failed to connect to the MetaStore Server URI (" + store + ")"); - } + LOG.warn("Failed to connect to the MetaStore Server"); + LOG.debug("Failed to connect to the MetaStore Server", e); } if (isConnected && !useSasl && !usePasswordAuth && @@ -771,10 +765,10 @@ public void close() { // just in case, we make this call. if ((transport != null) && transport.isOpen()) { transport.close(); - LOG.info("Closed a connection to metastore, current connections: " + connCount.decrementAndGet()); + final int connectionCount = connCount.decrementAndGet(); + LOG.info("Closed a connection to metastore, current connections: {}", connectionCount); if (LOG.isTraceEnabled()) { - LOG.trace("", new LogUtils.StackTraceLogger("METASTORE CONNECTION TRACE - close - " + - System.identityHashCode(this))); + LOG.trace("METASTORE CONNECTION TRACE - close - {}", System.identityHashCode(this), new Exception()); } } } @@ -3371,13 +3365,13 @@ public NotificationEventResponse getNextNotification(long lastEventId, int maxEv NotificationEventRequest rqst = new NotificationEventRequest(lastEventId); rqst.setMaxEvents(maxEvents); NotificationEventResponse rsp = client.get_next_notification(rqst); - LOG.debug("Got back " + rsp.getEventsSize() + " events"); + LOG.debug("Got back {} events", rsp.getEventsSize()); NotificationEventResponse filtered = new NotificationEventResponse(); if (rsp != null && rsp.getEvents() != null) { long nextEventId = lastEventId + 1; long prevEventId = lastEventId; for (NotificationEvent e : rsp.getEvents()) { - LOG.debug("Got event with id : " + e.getEventId()); + LOG.debug("Got event with id : {}", e.getEventId()); if (e.getEventId() != nextEventId) { if (e.getEventId() == prevEventId) { LOG.error("NOTIFICATION_LOG table has multiple events with the same event Id {}. " +