hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject hive git commit: HIVE-18075 : verify commands on a cluster (Harish Jaiprakash, reviewed by Sergey Shelukhin)
Date Tue, 12 Dec 2017 01:57:37 GMT
Repository: hive
Updated Branches:
  refs/heads/master 96c2fa86b -> d6ce23d53


HIVE-18075 : verify commands on a cluster (Harish Jaiprakash, reviewed by Sergey Shelukhin)


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

Branch: refs/heads/master
Commit: d6ce23d53d9605c3b28f155e4d0810c9c26d587c
Parents: 96c2fa8
Author: sergey <sershe@apache.org>
Authored: Mon Dec 11 17:51:05 2017 -0800
Committer: sergey <sershe@apache.org>
Committed: Mon Dec 11 17:51:05 2017 -0800

----------------------------------------------------------------------
 .../test/queries/clientpositive/resourceplan.q  |  4 ++++
 .../clientpositive/llap/resourceplan.q.out      |  8 ++++++-
 .../hadoop/hive/metastore/ObjectStore.java      | 23 +++++++++++++++-----
 3 files changed, 28 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/d6ce23d5/ql/src/test/queries/clientpositive/resourceplan.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/resourceplan.q b/ql/src/test/queries/clientpositive/resourceplan.q
index 002b21c..fc924a2 100644
--- a/ql/src/test/queries/clientpositive/resourceplan.q
+++ b/ql/src/test/queries/clientpositive/resourceplan.q
@@ -312,8 +312,12 @@ CREATE RESOURCE PLAN plan_4;
 
 ALTER RESOURCE PLAN plan_4 ENABLE ACTIVATE;
 
+-- This should remove all pools, triggers & mappings. 
 DROP RESOURCE PLAN plan_2;
 
+-- This should create plan_2 with default pool and null query parallelism.
+CREATE RESOURCE PLAN plan_2;
+
 SELECT * FROM SYS.WM_RESOURCEPLANS;
 SELECT * FROM SYS.WM_POOLS;
 SELECT * FROM SYS.WM_TRIGGERS;

http://git-wip-us.apache.org/repos/asf/hive/blob/d6ce23d5/ql/src/test/results/clientpositive/llap/resourceplan.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/resourceplan.q.out b/ql/src/test/results/clientpositive/llap/resourceplan.q.out
index 093e5d5..7f3e784 100644
--- a/ql/src/test/results/clientpositive/llap/resourceplan.q.out
+++ b/ql/src/test/results/clientpositive/llap/resourceplan.q.out
@@ -3977,7 +3977,7 @@ plan_2	USER	user1	def	0
 plan_2	USER	user2	def	1
 PREHOOK: query: DROP POOL plan_2.def.c1
 PREHOOK: type: DROP POOL
-FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:Exception
thrown flushing changes to datastore)
+FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. InvalidOperationException(message:Please
remove all mappings for this pool.)
 PREHOOK: query: DROP USER MAPPING "user2" in plan_2
 PREHOOK: type: DROP MAPPING
 POSTHOOK: query: DROP USER MAPPING "user2" in plan_2
@@ -4008,6 +4008,10 @@ PREHOOK: query: DROP RESOURCE PLAN plan_2
 PREHOOK: type: DROP RESOURCEPLAN
 POSTHOOK: query: DROP RESOURCE PLAN plan_2
 POSTHOOK: type: DROP RESOURCEPLAN
+PREHOOK: query: CREATE RESOURCE PLAN plan_2
+PREHOOK: type: CREATE RESOURCEPLAN
+POSTHOOK: query: CREATE RESOURCE PLAN plan_2
+POSTHOOK: type: CREATE RESOURCEPLAN
 PREHOOK: query: SELECT * FROM SYS.WM_RESOURCEPLANS
 PREHOOK: type: QUERY
 PREHOOK: Input: sys@wm_resourceplans
@@ -4017,6 +4021,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: sys@wm_resourceplans
 #### A masked pattern was here ####
 plan_1	ENABLED	NULL	default
+plan_2	DISABLED	NULL	default
 plan_4	ACTIVE	NULL	default
 table	DISABLED	1	table.pool
 PREHOOK: query: SELECT * FROM SYS.WM_POOLS
@@ -4028,6 +4033,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: sys@wm_pools
 #### A masked pattern was here ####
 plan_1	default	1.0	4	NULL
+plan_2	default	1.0	4	NULL
 plan_4	default	1.0	4	NULL
 table	table	0.0	1	random
 table	table.pool	0.9	3	priority

http://git-wip-us.apache.org/repos/asf/hive/blob/d6ce23d5/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index 2e80c9d..2c92bb2 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -9519,14 +9519,20 @@ public class ObjectStore implements RawStore, Configurable {
   }
 
   private void checkForConstraintException(Exception e, String msg) throws AlreadyExistsException
{
-    Throwable ex = e;
-    while (ex != null) {
-      if (ex instanceof SQLIntegrityConstraintViolationException) {
-        LOG.error(msg, e);
-        throw new AlreadyExistsException(msg);
+    if (getConstraintException(e) != null) {
+      LOG.error(msg, e);
+      throw new AlreadyExistsException(msg);
+    }
+  }
+
+  private Throwable getConstraintException(Throwable t) {
+    while (t != null) {
+      if (t instanceof SQLIntegrityConstraintViolationException) {
+        return t;
       }
-      ex = ex.getCause();
+      t = t.getCause();
     }
+    return null;
   }
 
   @Override
@@ -10214,6 +10220,11 @@ public class ObjectStore implements RawStore, Configurable {
         throw new NoSuchObjectException("Cannot delete pool: " + poolPath);
       }
       commited = commitTransaction();
+    } catch(Exception e) {
+      if (getConstraintException(e) != null) {
+        throw new InvalidOperationException("Please remove all mappings for this pool.");
+      }
+      throw e;
     } finally {
       rollbackAndCleanup(commited, query);
     }


Mime
View raw message