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 2019/03/26 21:33:50 UTC

[hive] branch master updated: HIVE-21479: NPE during metastore cache update (Daniel Dai, reviewed by Zoltan Haindrich)

This is an automated email from the ASF dual-hosted git repository.

daijy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 5708a0b  HIVE-21479: NPE during metastore cache update (Daniel Dai, reviewed by Zoltan Haindrich)
5708a0b is described below

commit 5708a0b797bf12b4f61afaf0d343ea6bd9b237e2
Author: Daniel Dai <da...@gmail.com>
AuthorDate: Tue Mar 26 14:33:11 2019 -0700

    HIVE-21479: NPE during metastore cache update (Daniel Dai, reviewed by Zoltan Haindrich)
    
    Signed-off-by: Zoltan Haindrich <ki...@rxd.hu>
---
 .../hadoop/hive/metastore/cache/CachedStore.java   | 31 +++++++++++++---------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
index 41b72d1..3564efe 100644
--- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
+++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
@@ -812,7 +812,7 @@ public class CachedStore implements RawStore, Configurable {
       rawStore.openTransaction();
       try {
         Table table = rawStore.getTable(catName, dbName, tblName);
-        if (!table.isSetPartitionKeys()) {
+        if (table != null && !table.isSetPartitionKeys()) {
           List<String> colNames = MetaStoreUtils.getColumnNamesForTable(table);
           Deadline.startTimer("getTableColumnStatistics");
 
@@ -856,18 +856,20 @@ public class CachedStore implements RawStore, Configurable {
       rawStore.openTransaction();
       try {
         Table table = rawStore.getTable(catName, dbName, tblName);
-        List<String> colNames = MetaStoreUtils.getColumnNamesForTable(table);
-        List<String> partNames = rawStore.listPartitionNames(catName, dbName, tblName, (short) -1);
-        // Get partition column stats for this table
-        Deadline.startTimer("getPartitionColumnStatistics");
-        List<ColumnStatistics> partitionColStats =
-            rawStore.getPartitionColumnStatistics(catName, dbName, tblName, partNames, colNames);
-        Deadline.stopTimer();
-        sharedCache.refreshPartitionColStatsInCache(catName, dbName, tblName, partitionColStats);
-        List<Partition> parts = rawStore.getPartitionsByNames(catName, dbName, tblName, partNames);
-        // Also save partitions for consistency as they have the stats state.
-        for (Partition part : parts) {
-          sharedCache.alterPartitionInCache(catName, dbName, tblName, part.getValues(), part);
+        if (table != null) {
+          List<String> colNames = MetaStoreUtils.getColumnNamesForTable(table);
+          List<String> partNames = rawStore.listPartitionNames(catName, dbName, tblName, (short) -1);
+          // Get partition column stats for this table
+          Deadline.startTimer("getPartitionColumnStatistics");
+          List<ColumnStatistics> partitionColStats =
+                  rawStore.getPartitionColumnStatistics(catName, dbName, tblName, partNames, colNames);
+          Deadline.stopTimer();
+          sharedCache.refreshPartitionColStatsInCache(catName, dbName, tblName, partitionColStats);
+          List<Partition> parts = rawStore.getPartitionsByNames(catName, dbName, tblName, partNames);
+          // Also save partitions for consistency as they have the stats state.
+          for (Partition part : parts) {
+            sharedCache.alterPartitionInCache(catName, dbName, tblName, part.getValues(), part);
+          }
         }
         committed = rawStore.commitTransaction();
       } catch (MetaException | NoSuchObjectException e) {
@@ -886,6 +888,9 @@ public class CachedStore implements RawStore, Configurable {
                                                        String tblName) {
       try {
         Table table = rawStore.getTable(catName, dbName, tblName);
+        if (table == null) {
+          return;
+        }
         List<String> partNames = rawStore.listPartitionNames(catName, dbName, tblName, (short) -1);
         List<String> colNames = MetaStoreUtils.getColumnNamesForTable(table);
         if ((partNames != null) && (partNames.size() > 0)) {