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 2016/05/17 20:43:26 UTC

hive git commit: HIVE-13608: We should provide better error message while constraints with duplicate names are created (Hari Subramaniyan, reviewed by Ashutosh Chauhan)

Repository: hive
Updated Branches:
  refs/heads/master 57d666a27 -> 298644f66


HIVE-13608: We should provide better error message while constraints with duplicate names are created (Hari Subramaniyan, reviewed by Ashutosh Chauhan)


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

Branch: refs/heads/master
Commit: 298644f6618b992dbb3352e26e51792edfb08605
Parents: 57d666a
Author: Hari Subramaniyan <ha...@apache.org>
Authored: Tue May 17 13:43:08 2016 -0700
Committer: Hari Subramaniyan <ha...@apache.org>
Committed: Tue May 17 13:43:08 2016 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/hadoop/hive/ql/QTestUtil.java   |  5 ++++-
 .../hadoop/hive/metastore/RetryingMetaStoreClient.java   |  6 ++++--
 .../create_with_constraints_duplicate_name.q.out         | 11 ++++++++++-
 3 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/298644f6/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
----------------------------------------------------------------------
diff --git a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
index 9e3aefb..11e529d 100644
--- a/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
+++ b/itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java
@@ -1470,7 +1470,10 @@ public class QTestUtil {
       ".*total number of created files now is.*",
       ".*.hive-staging.*",
       "pk_-?[0-9]*_[0-9]*_[0-9]*",
-      "fk_-?[0-9]*_[0-9]*_[0-9]*"
+      "fk_-?[0-9]*_[0-9]*_[0-9]*",
+      ".*at com\\.sun\\.proxy.*",
+      ".*at com\\.jolbox.*",
+      "org\\.apache\\.hadoop\\.hive\\.metastore\\.model\\.MConstraint@([0-9]|[a-z])*"
   });
 
   private final Pattern[] partialReservedPlanMask = toPattern(new String[] {

http://git-wip-us.apache.org/repos/asf/hive/blob/298644f6/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingMetaStoreClient.java b/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingMetaStoreClient.java
index 3c125e0..c0d9c0c 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingMetaStoreClient.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingMetaStoreClient.java
@@ -176,13 +176,15 @@ public class RetryingMetaStoreClient implements InvocationHandler {
           // TODO: most protocol exceptions are probably unrecoverable... throw?
           caughtException = (TException)t;
         } else if ((t instanceof MetaException) && t.getMessage().matches(
-            "(?s).*(JDO[a-zA-Z]*|TProtocol|TTransport)Exception.*")) {
+            "(?s).*(JDO[a-zA-Z]*|TProtocol|TTransport)Exception.*") &&
+            !t.getMessage().contains("java.sql.SQLIntegrityConstraintViolationException")) {
           caughtException = (MetaException)t;
         } else {
           throw t;
         }
       } catch (MetaException e) {
-        if (e.getMessage().matches("(?s).*(IO|TTransport)Exception.*")) {
+        if (e.getMessage().matches("(?s).*(IO|TTransport)Exception.*") &&
+            !e.getMessage().contains("java.sql.SQLIntegrityConstraintViolationException")) {
           caughtException = e;
         } else {
           throw e;

http://git-wip-us.apache.org/repos/asf/hive/blob/298644f6/ql/src/test/results/clientnegative/create_with_constraints_duplicate_name.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/create_with_constraints_duplicate_name.q.out b/ql/src/test/results/clientnegative/create_with_constraints_duplicate_name.q.out
index 20f5d30..8d6801e 100644
--- a/ql/src/test/results/clientnegative/create_with_constraints_duplicate_name.q.out
+++ b/ql/src/test/results/clientnegative/create_with_constraints_duplicate_name.q.out
@@ -10,4 +10,13 @@ PREHOOK: query: create table t2(x int, constraint pk1 primary key (x) disable no
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@t2
-FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:For direct MetaStore DB connections, we don't support retries at the client level.)
+FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:javax.jdo.JDOUserException: One or more instances could not be made persistent
+#### A masked pattern was here ####
+NestedThrowablesStackTrace:
+Insert of object "#### A masked pattern was here ####" using statement "INSERT INTO KEY_CONSTRAINTS (CHILD_CD_ID,CHILD_INTEGER_IDX,CHILD_TBL_ID,CONSTRAINT_TYPE,DELETE_RULE,ENABLE_VALIDATE_RELY,PARENT_CD_ID,PARENT_INTEGER_IDX,PARENT_TBL_ID,UPDATE_RULE,"CONSTRAINT_NAME","POSITION") VALUES (?,?,?,?,?,?,?,?,?,?,?,?)" failed : The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'KEY_CONSTRAINTS_PK' defined on 'KEY_CONSTRAINTS'.
+org.datanucleus.exceptions.NucleusDataStoreException: Insert of object "#### A masked pattern was here ####" using statement "INSERT INTO KEY_CONSTRAINTS (CHILD_CD_ID,CHILD_INTEGER_IDX,CHILD_TBL_ID,CONSTRAINT_TYPE,DELETE_RULE,ENABLE_VALIDATE_RELY,PARENT_CD_ID,PARENT_INTEGER_IDX,PARENT_TBL_ID,UPDATE_RULE,"CONSTRAINT_NAME","POSITION") VALUES (?,?,?,?,?,?,?,?,?,?,?,?)" failed : The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'KEY_CONSTRAINTS_PK' defined on 'KEY_CONSTRAINTS'.
+#### A masked pattern was here ####
+Nested Throwables StackTrace:
+java.sql.SQLIntegrityConstraintViolationException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'KEY_CONSTRAINTS_PK' defined on 'KEY_CONSTRAINTS'.
+#### A masked pattern was here ####
+)