[ 
https://issues.apache.org/jira/browse/HIVE-11668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14720412#comment-14720412
 ] 

Sushanth Sowmyan commented on HIVE-11668:
-----------------------------------------

This patch will still have an issue, as observed by [~wzheng] earlier today:

{noformat}
Caused by: org.datanucleus.api.jdo.exceptions.TransactionNotActiveException: 
Transaction is not active. You either need to define a transaction around this, 
or run your PersistenceManagerFactory with 'NontransactionalRead' and 
'NontransactionalWrite' set to 'true'
FailedObject:org.datanucleus.exceptions.TransactionNotActiveException: 
Transaction is not active. You either need to define a transaction around this, 
or run your PersistenceManagerFactory with 'NontransactionalRead' and 
'NontransactionalWrite' set to 'true'
at 
org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:396)
at org.datanucleus.api.jdo.JDOTransaction.rollback(JDOTransaction.java:186)
at 
org.apache.hadoop.hive.metastore.MetaStoreDirectSql.ensureDbInit(MetaStoreDirectSql.java:196)
at 
org.apache.hadoop.hive.metastore.MetaStoreDirectSql.<init>(MetaStoreDirectSql.java:137)
at org.apache.hadoop.hive.metastore.ObjectStore.initialize(ObjectStore.java:335)
at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:286)
at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:76)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:136)
at org.apache.hadoop.hive.metastore.RawStoreProxy.<init>(RawStoreProxy.java:57)
at 
org.apache.hadoop.hive.metastore.RawStoreProxy.getProxy(RawStoreProxy.java:66)
at 
org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.newRawStore(HiveMetaStore.java:601)
at 
org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.getMS(HiveMetaStore.java:579)
at 
org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.createDefaultDB(HiveMetaStore.java:632)
at 
org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.init(HiveMetaStore.java:468)
at 
org.apache.hadoop.hive.metastore.RetryingHMSHandler.<init>(RetryingHMSHandler.java:66)
at 
org.apache.hadoop.hive.metastore.RetryingHMSHandler.getProxy(RetryingHMSHandler.java:72)
at 
org.apache.hadoop.hive.metastore.HiveMetaStore.newRetryingHMSHandler(HiveMetaStore.java:5815)
at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.<init>(HiveMetaStoreClient.java:203)
at 
org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.<init>(SessionHiveMetaStoreClient.java:74)
... 19 more
{noformat}

The issue here is this. Earlier, the runDbCheck() function was instantiating a 
transaction if it wasn't already open. So, as long as we were determining the 
db type by using runDbCheck, we were opening the txn as a side-effect (ugh). 
Now, by determining the product name by the jdbc provider, we're not calling 
runDbCheck, and thus, the txn is never opened.

You need the following in your chain, hopefully in a more sane place than in 
runDbCheck():

{noformat}
     Transaction tx = pm.currentTransaction();
+    if (!tx.isActive()) {
+      tx.begin();
+    }
{noformat}



> make sure directsql calls pre-query init when needed
> ----------------------------------------------------
>
>                 Key: HIVE-11668
>                 URL: https://issues.apache.org/jira/browse/HIVE-11668
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>            Reporter: Sergey Shelukhin
>            Assignee: Sergey Shelukhin
>         Attachments: HIVE-11668.patch
>
>
> See comments in HIVE-11123



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to