[ 
https://issues.apache.org/jira/browse/HIVE-18890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16767522#comment-16767522
 ] 

Andrew Sherman commented on HIVE-18890:
---------------------------------------

+1 LGTM

> Lower Logging for "Table not found" Error
> -----------------------------------------
>
>                 Key: HIVE-18890
>                 URL: https://issues.apache.org/jira/browse/HIVE-18890
>             Project: Hive
>          Issue Type: Improvement
>          Components: HiveServer2
>    Affects Versions: 3.0.0
>            Reporter: BELUGA BEHR
>            Assignee: Manoj Narayanan
>            Priority: Minor
>         Attachments: HIVE-18890.1.patch
>
>
> https://github.com/apache/hive/blob/7cb31c03052b815665b3231f2e513b9e65d3ff8c/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java#L1105
> {code:java}
>     // Get the table from metastore
>     org.apache.hadoop.hive.metastore.api.Table tTable = null;
>     try {
>       tTable = getMSC().getTable(dbName, tableName);
>     } catch (NoSuchObjectException e) {
>       if (throwException) {
>         LOG.error("Table " + tableName + " not found: " + e.getMessage());
>         throw new InvalidTableException(tableName);
>       }
>       return null;
>     } catch (Exception e) {
>       throw new HiveException("Unable to fetch table " + tableName + ". " + 
> e.getMessage(), e);
>     }
> {code}
> We should throw an exception or log it, but not both. Right [~mdrob] ? ;)
> And in this case, we are generating scary ERROR level logging in the 
> HiveServer2 logs needlessly.  This should not be reported as an application 
> error.  It is a simple user error, indicated by catching the 
> _NoSuchObjectException_ Throwable, that can always be ignored by the service. 
>  It is most likely a simple user typo of the table name.  However, the more 
> serious general _Exception_ is not logged.  This is backwards.
> Please remove the _error_ level logging for the user error... or lower it to 
> _debug_ level logging.
> Please include an _error_ level logging to the general Exception case, unless 
> this Exception is being captured up the stack, somewhere else, and is being 
> logged there at ERROR level logging.
> {code}
> -- Sample log messages found in HS2 logs
> 2018-03-02 10:26:40,363  ERROR hive.ql.metadata.Hive: 
> [HiveServer2-Handler-Pool: Thread-4467]: Table default not found: 
> default.default table not found
> 2018-03-02 10:26:40,367  ERROR hive.ql.metadata.Hive: 
> [HiveServer2-Handler-Pool: Thread-4467]: Table default not found: 
> default.default table not found
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to