You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by da...@apache.org on 2017/06/08 17:38:31 UTC
hive git commit: HIVE-16848: NPE during CachedStore refresh (Daniel
Dai, reviewed by Vaibhav Gumashta, Thejas Nair)
Repository: hive
Updated Branches:
refs/heads/master 41f72dc3e -> 6fb647f32
HIVE-16848: NPE during CachedStore refresh (Daniel Dai, reviewed by Vaibhav Gumashta, Thejas Nair)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/6fb647f3
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/6fb647f3
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/6fb647f3
Branch: refs/heads/master
Commit: 6fb647f32ce4e393c4bfcd871821d4da166abaa0
Parents: 41f72dc
Author: Daniel Dai <da...@hortonworks.com>
Authored: Thu Jun 8 10:38:04 2017 -0700
Committer: Daniel Dai <da...@hortonworks.com>
Committed: Thu Jun 8 10:38:04 2017 -0700
----------------------------------------------------------------------
.../hive/metastore/cache/CachedStore.java | 41 +++++++++++---------
1 file changed, 23 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/6fb647f3/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
index 590e9ce..3ac4fe1 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
@@ -85,6 +85,7 @@ import org.apache.hadoop.hive.metastore.hbase.stats.merge.ColumnStatsMergerFacto
import org.apache.hadoop.hive.metastore.partition.spec.PartitionSpecProxy;
import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.hadoop.util.StringUtils;
import org.apache.hive.common.util.HiveStringUtils;
import org.apache.thrift.TException;
import org.slf4j.Logger;
@@ -355,10 +356,10 @@ public class CachedStore implements RawStore, Configurable {
}
}
}
- } catch (MetaException e) {
- LOG.error("Updating CachedStore: error getting database names", e);
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException("Cannot instantiate " + rawStoreClassName, e);
+ } catch (Exception e) {
+ LOG.error("Updating CachedStore: error happen when refresh", e);
} finally {
try {
if (rawStore != null) {
@@ -460,15 +461,17 @@ public class CachedStore implements RawStore, Configurable {
ColumnStatistics tableColStats =
rawStore.getTableColumnStatistics(dbName, tblName, colNames);
Deadline.stopTimer();
- if (tableColStatsCacheLock.writeLock().tryLock()) {
- // Skip background updates if we detect change
- if (isTableColStatsCacheDirty.compareAndSet(true, false)) {
- LOG.debug("Skipping table column stats cache update; the table column stats list we "
- + "have is dirty.");
- return;
+ if (tableColStats != null) {
+ if (tableColStatsCacheLock.writeLock().tryLock()) {
+ // Skip background updates if we detect change
+ if (isTableColStatsCacheDirty.compareAndSet(true, false)) {
+ LOG.debug("Skipping table column stats cache update; the table column stats list we "
+ + "have is dirty.");
+ return;
+ }
+ SharedCache.refreshTableColStats(HiveStringUtils.normalizeIdentifier(dbName),
+ HiveStringUtils.normalizeIdentifier(tblName), tableColStats.getStatsObj());
}
- SharedCache.refreshTableColStats(HiveStringUtils.normalizeIdentifier(dbName),
- HiveStringUtils.normalizeIdentifier(tblName), tableColStats.getStatsObj());
}
} catch (MetaException | NoSuchObjectException e) {
LOG.info("Updating CachedStore: unable to read table column stats of table: " + tblName, e);
@@ -486,15 +489,17 @@ public class CachedStore implements RawStore, Configurable {
Map<String, List<ColumnStatisticsObj>> colStatsPerPartition =
rawStore.getColStatsForTablePartitions(dbName, tblName);
Deadline.stopTimer();
- if (partitionColStatsCacheLock.writeLock().tryLock()) {
- // Skip background updates if we detect change
- if (isPartitionColStatsCacheDirty.compareAndSet(true, false)) {
- LOG.debug("Skipping partition column stats cache update; the partition column stats "
- + "list we have is dirty.");
- return;
+ if (colStatsPerPartition != null) {
+ if (partitionColStatsCacheLock.writeLock().tryLock()) {
+ // Skip background updates if we detect change
+ if (isPartitionColStatsCacheDirty.compareAndSet(true, false)) {
+ LOG.debug("Skipping partition column stats cache update; the partition column stats "
+ + "list we have is dirty.");
+ return;
+ }
+ SharedCache.refreshPartitionColStats(HiveStringUtils.normalizeIdentifier(dbName),
+ HiveStringUtils.normalizeIdentifier(tblName), colStatsPerPartition);
}
- SharedCache.refreshPartitionColStats(HiveStringUtils.normalizeIdentifier(dbName),
- HiveStringUtils.normalizeIdentifier(tblName), colStatsPerPartition);
}
} catch (MetaException | NoSuchObjectException e) {
LOG.info("Updating CachedStore: unable to read partitions column stats of table: "