Repository: hive
Updated Branches:
  refs/heads/branch-2.1 429a2da20 -> e045c5a57


HIVE-14090: JDOExceptions thrown by the Metastore have their full stack trace 
returned to clients (Sahil Takiar, reviewed by Sergio Pena)

Change-Id: I5242436f65c2cc2c9e48f7ebca518f1930e5f4c1


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

Branch: refs/heads/branch-2.1
Commit: 3701a7aa2e5e75b3a4d794618ee74d693963d30b
Parents: 429a2da
Author: Sahil Takiar <takiar.sa...@gmail.com>
Authored: Wed Jul 6 16:34:19 2016 -0500
Committer: Sergio Pena <sergio.p...@cloudera.com>
Committed: Wed Sep 28 15:36:09 2016 -0500

----------------------------------------------------------------------
 .../apache/hadoop/hive/metastore/RetryingHMSHandler.java |  6 +++---
 .../create_with_constraints_duplicate_name.q.out         | 11 +----------
 2 files changed, 4 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/3701a7aa/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java
----------------------------------------------------------------------
diff --git 
a/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java 
b/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java
index 2fc487f..e46b50d 100644
--- 
a/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java
+++ 
b/metastore/src/java/org/apache/hadoop/hive/metastore/RetryingHMSHandler.java
@@ -200,9 +200,9 @@ public class RetryingHMSHandler implements 
InvocationHandler {
 
       if (retryCount >= retryLimit) {
         LOG.error("HMSHandler Fatal error: " + 
ExceptionUtils.getStackTrace(caughtException));
-        // Since returning exceptions with a nested "cause" can be a problem in
-        // Thrift, we are stuffing the stack trace into the message itself.
-        throw new MetaException(ExceptionUtils.getStackTrace(caughtException));
+        MetaException me = new MetaException(caughtException.getMessage());
+        me.initCause(caughtException);
+        throw me;
       }
 
       assert (retryInterval >= 0);

http://git-wip-us.apache.org/repos/asf/hive/blob/3701a7aa/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 8d6801e..989ff38 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,13 +10,4 @@ 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: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 ####
-)
+FAILED: Execution Error, return code 1 from 
org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:One or more 
instances could not be made persistent)

Reply via email to