This is an automated email from the ASF dual-hosted git repository.

dmollitor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 8638894  HIVE-22428: Remove superfluous 'Failed to get database' WARN 
Logging in ObjectStore (David Mollitor, reviewed by Miklos Gergely)
8638894 is described below

commit 863889451ec838ed91ae4d80c03992a4eae4b482
Author: David Mollitor <dmolli...@apache.org>
AuthorDate: Fri Nov 1 10:00:15 2019 -0400

    HIVE-22428: Remove superfluous 'Failed to get database' WARN Logging in 
ObjectStore (David Mollitor, reviewed by Miklos Gergely)
---
 .../apache/hadoop/hive/metastore/ObjectStore.java  | 54 +++++++++-------------
 1 file changed, 21 insertions(+), 33 deletions(-)

diff --git 
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
 
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index e41c968..571eb86 100644
--- 
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ 
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -512,7 +512,7 @@ public class ObjectStore implements RawStore, Configurable {
 
   @Override
   public void createCatalog(Catalog cat) throws MetaException {
-    LOG.debug("Creating catalog " + cat.getName());
+    LOG.debug("Creating catalog {}", cat);
     boolean committed = false;
     MCatalog mCat = catToMCat(cat);
     try {
@@ -553,7 +553,7 @@ public class ObjectStore implements RawStore, Configurable {
 
   @Override
   public Catalog getCatalog(String catalogName) throws NoSuchObjectException, 
MetaException {
-    LOG.debug("Fetching catalog " + catalogName);
+    LOG.debug("Fetching catalog {}", catalogName);
     MCatalog mCat = getMCatalog(catalogName);
     if (mCat == null) {
       throw new NoSuchObjectException("No catalog " + catalogName);
@@ -585,7 +585,7 @@ public class ObjectStore implements RawStore, Configurable {
 
   @Override
   public void dropCatalog(String catalogName) throws NoSuchObjectException, 
MetaException {
-    LOG.debug("Dropping catalog " + catalogName);
+    LOG.debug("Dropping catalog {}", catalogName);
     boolean committed = false;
     try {
       openTransaction();
@@ -705,7 +705,7 @@ public class ObjectStore implements RawStore, Configurable {
       ex = e;
     }
     if (db == null) {
-      LOG.warn("Failed to get database {}.{}, returning NoSuchObjectException",
+      LOG.debug("Failed to get database {}.{}, returning 
NoSuchObjectException",
           catalogName, name, ex);
       throw new NoSuchObjectException(name + (ex == null ? "" : (": " + 
ex.getMessage())));
     }
@@ -1526,7 +1526,7 @@ public class ObjectStore implements RawStore, 
Configurable {
       }
 
       if (LOG.isDebugEnabled()) {
-        LOG.debug("getTableMeta with filter " + filterBuilder.toString() + " 
params: " +
+        LOG.debug("getTableMeta with filter " + filterBuilder + " params: " +
             StringUtils.join(parameterVals, ", "));
       }
       // Add the fetch group here which retrieves the database object along 
with the MTable
@@ -1628,8 +1628,10 @@ public class ObjectStore implements RawStore, 
Configurable {
       query.declareParameters(
           "java.lang.String table, java.lang.String db, java.lang.String 
catname");
       query.setUnique(true);
-      LOG.debug("Executing getMTable for " +
-          TableName.getQualified(catName, db, table));
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Executing getMTable for {}",
+            TableName.getQualified(catName, db, table));
+      }
       mtbl = (MTable) query.execute(table, db, catName);
       pm.retrieve(mtbl);
       // Retrieving CD can be expensive and unnecessary, so do it only when 
required.
@@ -3623,9 +3625,7 @@ public class ObjectStore implements RawStore, 
Configurable {
         message = ex.toString() + "; error building a better message: " + 
t.getMessage();
       }
       LOG.warn(message); // Don't log the exception, people just get confused.
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Full DirectSQL callstack for debugging (note: this is not 
an error)", ex);
-      }
+      LOG.debug("Full DirectSQL callstack for debugging (not an error)", ex);
       if (!allowJdo) {
         if (ex instanceof MetaException) {
           throw (MetaException)ex;
@@ -8679,7 +8679,8 @@ public class ObjectStore implements RawStore, 
Configurable {
       committed = commitTransaction();
       return result;
     } finally {
-      LOG.debug("Done executing getTableColumnStatistics with status : {}", 
committed);
+      LOG.debug("Done executing getTableColumnStatistics with status : {}",
+          committed);
       rollbackAndCleanup(committed, query);
     }
   }
@@ -8785,7 +8786,8 @@ public class ObjectStore implements RawStore, 
Configurable {
       committed = commitTransaction();
       return result;
     } finally {
-      LOG.debug("Done executing getTableColumnStatistics with status : {}", 
committed);
+      LOG.debug("Done executing getTableColumnStatistics with status : {}",
+          committed);
       rollbackAndCleanup(committed, query);
     }
   }
@@ -8913,8 +8915,9 @@ public class ObjectStore implements RawStore, 
Configurable {
 
         if (!isCurrentStatsValidForTheQuery(part, part.getWriteId(), 
writeIdList, false)) {
           String partName = Warehouse.makePartName(table.getPartitionKeys(), 
part.getValues());
-          LOG.debug("The current metastore transactional partition column 
statistics for " + dbName
-              + "." + tblName + "." + partName + " is not valid for the 
current query");
+          LOG.debug("The current metastore transactional partition column "
+              + "statistics for {}.{}.{} is not valid for the current query",
+              dbName, tblName, partName);
           return null;
         }
       }
@@ -9615,27 +9618,12 @@ public class ObjectStore implements RawStore, 
Configurable {
     return this.getMPartition(catName, dbName, tableName, name) != null;
   }
 
-  private void debugLog(String message) {
+  private void debugLog(final String message) {
     if (LOG.isDebugEnabled()) {
-      LOG.debug("{} {}", message, getCallStack());
+      LOG.debug("{}", message, new Exception());
     }
   }
 
-  private static final int stackLimit = 3;
-
-  private String getCallStack() {
-    StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
-    int thislimit = Math.min(stackLimit, stackTrace.length);
-    StringBuilder sb = new StringBuilder();
-    sb.append(" at:");
-    // Offset by 4 because the first 4 frames are just calls to get down here.
-    for (int i = 4; i < thislimit + 4; i++) {
-      sb.append("\n\t");
-      sb.append(stackTrace[i].toString());
-    }
-    return sb.toString();
-  }
-
   private Function convertToFunction(MFunction mfunc) {
     if (mfunc == null) {
       return null;
@@ -11115,7 +11103,7 @@ public class ObjectStore implements RawStore, 
Configurable {
         parameters.put("colType", type);
       }
       if (LOG.isDebugEnabled()) {
-        LOG.debug("getSchemaVersionsByColumns going to execute query " + 
sql.toString());
+        LOG.debug("getSchemaVersionsByColumns going to execute query {}", sql);
         LOG.debug("With parameters");
         for (Map.Entry<String, String> p : parameters.entrySet()) {
           LOG.debug(p.getKey() + " : " + p.getValue());
@@ -12435,7 +12423,7 @@ public class ObjectStore implements RawStore, 
Configurable {
 
   @Override
   public void addRuntimeStat(RuntimeStat stat) throws MetaException {
-    LOG.debug("runtimeStat: " + stat);
+    LOG.debug("runtimeStat: {}", stat);
     MRuntimeStat mStat = MRuntimeStat.fromThrift(stat);
     boolean committed = false;
     openTransaction();

Reply via email to