You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2012/04/18 01:25:49 UTC
svn commit: r1327323 -
/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
Author: hashutosh
Date: Tue Apr 17 23:25:49 2012
New Revision: 1327323
URL: http://svn.apache.org/viewvc?rev=1327323&view=rev
Log:
HIVE-2946 [jira] Hive metastore does not have any log messages while shutting
itself down.
(Vandana Kasavajjala via Ashutosh Chauhan)
Summary:
https://issues.apache.org/jira/browse/HIVE-2946
Addressed Ashutosh's comments.
When hive metastore is started, the event is logged with good amount of
information. But when it is stopped ( using a kill) command, no information is
being written to the logs. It will be good if we can add a shutdown event to the
HiveMetastore class.
Test Plan: EMPTY
Reviewers: JIRA, ashutoshc
Reviewed By: ashutoshc
Differential Revision: https://reviews.facebook.net/D2787
Modified:
hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java?rev=1327323&r1=1327322&r2=1327323&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java Tue Apr 17 23:25:49 2012
@@ -2938,7 +2938,7 @@ public class HiveMetaStore extends Thrif
public static void main(String[] args) throws Throwable {
HiveMetastoreCli cli = new HiveMetastoreCli();
cli.parse(args);
-
+ final boolean isCliVerbose = cli.isVerbose();
// NOTE: It is critical to do this prior to initializing log4j, otherwise
// any log specific settings via hiveconf will be ignored
Properties hiveconf = cli.addHiveconfToSystemProperties();
@@ -2969,6 +2969,18 @@ public class HiveMetaStore extends Thrif
conf.set((String) item.getKey(), (String) item.getValue());
}
+ //Add shutdown hook.
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ String shutdownMsg = "Shutting down hive metastore.";
+ HMSHandler.LOG.info(shutdownMsg);
+ if (isCliVerbose) {
+ System.err.println(shutdownMsg);
+ }
+ }
+ });
+
startMetaStore(cli.port, ShimLoader.getHadoopThriftAuthBridge(), conf);
} catch (Throwable t) {
// Catch the exception, log it and rethrow it.