hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Vary (JIRA)" <>
Subject [jira] [Commented] (HIVE-16357) Failed folder creation when creating a new table is reported incorrectly
Date Tue, 01 Aug 2017 15:29:00 GMT


Peter Vary commented on HIVE-16357:

[~spena]: The original issue is the following with the original code:
- When the table creation is failed
- DBNotificationListener will be triggered with incomplete data
- DBNotificationListener will throw a new exception which will mask the original from the
user, making it harder to find the root problem

The patch fixes it by adding the check inside the DBNotificationListener, thus avoiding throwing
the second exception. Also the patch makes sure that if there is any further exceptions thrown
by the DBNotificationListener, or any other Listener configured by the user, they are catched,
logged and not propagated further.

The rationale behind this solution is the following:
- Listeners can be configured by the user, so they can have different usages. For example
one listener might only collect failed table creation events. In this case the listeners should
be notified on every event, and the listener should decide which event to handle, and which
event to omit.
- DBNotificationListener on the other hand is not interested in the failed events, so it should
skip these events.
- Also we thought, that listeners are configured by the users, so their code can be unstable,
buggy. With this in mind, it would be good be sure that they do not affect each other. So
if there is an error in one listener then the other listeners should still be notified.

We might not be aware of every usage patterns of the Listeners, or might overcomplicate this
Listener architecture. What do you think [~spena]? Is it worth to be prepared to these use-cases?


> Failed folder creation when creating a new table is reported incorrectly
> ------------------------------------------------------------------------
>                 Key: HIVE-16357
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>    Affects Versions: 2.3.0, 3.0.0
>            Reporter: Barna Zsombor Klara
>            Assignee: Barna Zsombor Klara
>            Priority: Minor
>             Fix For: 3.0.0
>         Attachments: HIVE-16357.01.patch, HIVE-16357.02.patch, HIVE-16357.03.patch, HIVE-16357.04.patch
> If the directory for a Hive table could not be created, them the HMS will throw a metaexception:
> {code}
>  if (tblPath != null) {
>           if (!wh.isDir(tblPath)) {
>             if (!wh.mkdirs(tblPath, true)) {
>               throw new MetaException(tblPath
>                   + " is not a directory or unable to create one");
>             }
>             madeDir = true;
>           }
>         }
> {code}
> However in the finally block we always try to call the DbNotificationListener, which
in turn will also throw an exception because the directory is missing, overwriting the initial
exception with a FileNotFoundException.
> Actual stacktrace seen by the caller:
> {code}
> 2017-04-03T05:58:00,128 ERROR [pool-7-thread-2] metastore.RetryingHMSHandler: MetaException(message:java.lang.RuntimeException: File file:/.../0 does not exist)
> 	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newMetaException(
> 	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_with_environment_context(
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> 	at java.lang.reflect.Method.invoke(
> 	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invokeInternal(
> 	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(
> 	at com.sun.proxy.$Proxy28.create_table_with_environment_context(Unknown Source)
> 	at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Processor$create_table_with_environment_context.getResult(
> 	at org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Processor$create_table_with_environment_context.getResult(
> 	at org.apache.thrift.ProcessFunction.process(
> 	at org.apache.hadoop.hive.metastore.TUGIBasedProcessor$
> 	at org.apache.hadoop.hive.metastore.TUGIBasedProcessor$
> 	at Method)
> 	at
> 	at
> 	at org.apache.hadoop.hive.metastore.TUGIBasedProcessor.process(
> 	at org.apache.thrift.server.TThreadPoolServer$
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(
> 	at java.util.concurrent.ThreadPoolExecutor$
> 	at
> Caused by: java.lang.RuntimeException: File file:/.../0
does not exist
> 	at org.apache.hive.hcatalog.listener.DbNotificationListener$FileIterator.<init>(
> 	at org.apache.hive.hcatalog.listener.DbNotificationListener.onCreateTable(
> 	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_core(
> 	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_with_environment_context(
> 	... 20 more
> Caused by: File file:/.../0 does not exist
> 	at org.apache.hadoop.fs.RawLocalFileSystem.listStatus(
> 	at org.apache.hadoop.fs.FileSystem.listStatus(
> 	at org.apache.hadoop.fs.FileSystem.listStatus(
> 	at org.apache.hadoop.fs.ChecksumFileSystem.listStatus(
> 	at org.apache.hadoop.fs.FilterFileSystem.listStatus(
> 	at org.apache.hadoop.fs.ProxyFileSystem.listStatus(
> 	at org.apache.hadoop.fs.FilterFileSystem.listStatus(
> 	at org.apache.hadoop.fs.FileSystem.listStatus(
> 	at org.apache.hadoop.fs.FileSystem.listStatus(
> 	at org.apache.hive.hcatalog.listener.DbNotificationListener$FileIterator.<init>(
> 	... 23 more
> {code}
> The original exception should be thrown back to the caller while any exception from the
finally block should be caught/handled/logged out locally.

This message was sent by Atlassian JIRA

View raw message