Skip to content

Commit

Permalink
HIVE-11157: Hive.get(HiveConf) returns same Hive object to different …
Browse files Browse the repository at this point in the history
…user sessions (Chaoyu Tang, reviewed by Jimmy Xiang)
  • Loading branch information
chaoyu-tang committed Jul 2, 2015
1 parent 023c06c commit 470d9c8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public static Hive get(Configuration c, Class<?> clazz) throws HiveException {
/**
* Gets hive object for the current thread. If one is not initialized then a
* new one is created If the new configuration is different in metadata conf
* vars then a new one is created.
* vars, or the owner will be different then a new one is created.
*
* @param c
* new Hive Configuration
Expand All @@ -204,7 +204,7 @@ public static Hive get(Configuration c, Class<?> clazz) throws HiveException {
*/
public static Hive get(HiveConf c) throws HiveException {
Hive db = hiveDB.get();
if (db == null ||
if (db == null || !db.isCurrentUserOwner() ||
(db.metaStoreClient != null && !db.metaStoreClient.isCompatibleWith(c))) {
return get(c, true);
}
Expand Down Expand Up @@ -292,6 +292,9 @@ private void close() {
metaStoreClient.close();
metaStoreClient = null;
}
if (owner != null) {
owner = null;
}
}

/**
Expand Down

0 comments on commit 470d9c8

Please sign in to comment.