Repository: drill
Updated Branches:
  refs/heads/master 03e8f9f3e -> 1e6fa00cd


DRILL-4964: Make Drill reconnect to hive metastore after hive metastore is 
restarted.

Drill fails to connect to hive metastore after hive metastore is restarted 
unless drillbits are restarted.

Changes: For methods DrillHiveMetaStoreClient.getAllDatabases() and 
DrillHiveMetaStoreClient.getAllTables(),
the HiveMetaStoreClient wraps MetaException and TException both into 
MetaException. In case of connection
failure which is thrown as TException it is difficult to categorize at 
DrillClient level. The fix is to
close older connection and reconnect in case of these 2 api's. In all other 
cases proper set of exceptions
are thrown where we can handle each one individually.

close apache/drill#628


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/ca3733e3
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/ca3733e3
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/ca3733e3

Branch: refs/heads/master
Commit: ca3733e38197f77c6bd7f8b7e03cdd9f5dd87f18
Parents: 03e8f9f
Author: Sorabh Hamirwasia <[email protected]>
Authored: Tue Oct 25 18:52:01 2016 -0700
Committer: Jinfeng Ni <[email protected]>
Committed: Sat Oct 29 21:52:21 2016 -0700

----------------------------------------------------------------------
 .../exec/store/hive/DrillHiveMetaStoreClient.java | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/ca3733e3/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/DrillHiveMetaStoreClient.java
----------------------------------------------------------------------
diff --git 
a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/DrillHiveMetaStoreClient.java
 
b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/DrillHiveMetaStoreClient.java
index 2fe291b..d7ba659 100644
--- 
a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/DrillHiveMetaStoreClient.java
+++ 
b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/DrillHiveMetaStoreClient.java
@@ -204,8 +204,12 @@ public abstract class DrillHiveMetaStoreClient extends 
HiveMetaStoreClient {
     try {
       return mClient.getAllDatabases();
     } catch (MetaException e) {
-      throw e;
-    } catch (TException e) {
+      /*
+         HiveMetaStoreClient is encapsulating both the 
MetaException/TExceptions inside MetaException.
+         Since we don't have good way to differentiate, we will close older 
connection and retry once.
+         This is only applicable for getAllTables and getAllDatabases method 
since other methods are
+         properly throwing correct exceptions.
+      */
       logger.warn("Failure while attempting to get hive databases. Retries 
once.", e);
       try {
         mClient.close();
@@ -222,9 +226,13 @@ public abstract class DrillHiveMetaStoreClient extends 
HiveMetaStoreClient {
       throws TException {
     try {
       return mClient.getAllTables(dbName);
-    } catch (MetaException | UnknownDBException e) {
-      throw e;
-    } catch (TException e) {
+    } catch (MetaException e) {
+      /*
+         HiveMetaStoreClient is encapsulating both the 
MetaException/TExceptions inside MetaException.
+         Since we don't have good way to differentiate, we will close older 
connection and retry once.
+         This is only applicable for getAllTables and getAllDatabases method 
since other methods are
+         properly throwing correct exceptions.
+      */
       logger.warn("Failure while attempting to get hive tables. Retries 
once.", e);
       try {
         mClient.close();

Reply via email to