FAQ
Author: gates
Date: Tue Sep 23 14:44:17 2014
New Revision: 1627045

URL: http://svn.apache.org/r1627045
Log:
HIVE-7883 DBTxnManager trying to close already closed metastore client connection (Alan Gates, reviewed by Ashutosh Chauhan)

Modified:
     hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbLockManager.java
     hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbLockManager.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbLockManager.java?rev=1627045&r1=1627044&r2=1627045&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbLockManager.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbLockManager.java Tue Sep 23 14:44:17 2014
@@ -20,6 +20,7 @@ package org.apache.hadoop.hive.ql.lockmg
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
+import org.apache.hadoop.hive.metastore.IMetaStoreClient;
  import org.apache.hadoop.hive.metastore.api.*;
  import org.apache.hadoop.hive.ql.ErrorMsg;
  import org.apache.thrift.TException;
@@ -42,10 +43,10 @@ public class DbLockManager implements Hi
    private static final long MAX_SLEEP = 15000;
    private HiveLockManagerCtx context;
    private Set<DbHiveLock> locks;
- private HiveMetaStoreClient client;
+ private IMetaStoreClient client;
    private long nextSleep = 50;

- DbLockManager(HiveMetaStoreClient client) {
+ DbLockManager(IMetaStoreClient client) {
      locks = new HashSet<DbHiveLock>();
      this.client = client;
    }
@@ -210,8 +211,8 @@ public class DbLockManager implements Hi
    /**
     * Clear the memory of the locks in this object. This won't clear the locks from the database.
     * It is for use with
- * {@link #DbLockManager(org.apache.hadoop.hive.metastore.HiveMetaStoreClient).commitTxn} and
- * {@link #DbLockManager(org.apache.hadoop.hive.metastore.HiveMetaStoreClient).rollbackTxn}.
+ * {@link #DbLockManager(org.apache.hadoop.hive.metastore.IMetaStoreClient).commitTxn} and
+ * {@link #DbLockManager(org.apache.hadoop.hive.metastore.IMetaStoreClient).rollbackTxn}.
     */
    void clearLocalLockRecords() {
      locks.clear();

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java?rev=1627045&r1=1627044&r2=1627045&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/DbTxnManager.java Tue Sep 23 14:44:17 2014
@@ -31,6 +31,8 @@ import org.apache.hadoop.hive.ql.QueryPl
  import org.apache.hadoop.hive.ql.hooks.Entity;
  import org.apache.hadoop.hive.ql.hooks.ReadEntity;
  import org.apache.hadoop.hive.ql.hooks.WriteEntity;
+import org.apache.hadoop.hive.ql.metadata.Hive;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
  import org.apache.hadoop.hive.ql.metadata.Table;
  import org.apache.thrift.TException;

@@ -46,7 +48,7 @@ public class DbTxnManager extends HiveTx
    static final private Log LOG = LogFactory.getLog(CLASS_NAME);

    private DbLockManager lockMgr = null;
- private HiveMetaStoreClient client = null;
+ private IMetaStoreClient client = null;
    private long txnId = 0;

    DbTxnManager() {
@@ -311,7 +313,6 @@ public class DbTxnManager extends HiveTx
      try {
        if (txnId > 0) rollbackTxn();
        if (lockMgr != null) lockMgr.close();
- if (client != null) client.close();
      } catch (Exception e) {
        LOG.error("Caught exception " + e.getClass().getName() + " with message <" + e.getMessage()
        + ">, swallowing as there is nothing we can do with it.");
@@ -326,10 +327,12 @@ public class DbTxnManager extends HiveTx
              "methods.");
        }
        try {
- client = new HiveMetaStoreClient(conf);
+ Hive db = Hive.get(conf);
+ client = db.getMSC();
        } catch (MetaException e) {
- throw new LockException(ErrorMsg.METASTORE_COULD_NOT_INITIATE.getMsg(),
- e);
+ throw new LockException(ErrorMsg.METASTORE_COULD_NOT_INITIATE.getMsg(), e);
+ } catch (HiveException e) {
+ throw new LockException(ErrorMsg.METASTORE_COULD_NOT_INITIATE.getMsg(), e);
        }
      }
    }

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupcommits @
categorieshive, hadoop
postedSep 23, '14 at 2:57p
activeSep 23, '14 at 2:57p
posts1
users1
websitehive.apache.org

1 user in discussion

Gates: 1 post

People

Translate

site design / logo © 2021 Grokbase