impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tarmstr...@apache.org
Subject incubator-impala git commit: IMPALA-5469: Fix exception when processing catalog update
Date Fri, 09 Jun 2017 18:03:06 GMT
Repository: incubator-impala
Updated Branches:
  refs/heads/master eea4ad7ca -> 87a7a6418


IMPALA-5469: Fix exception when processing catalog update

In IMPALA-5355 patch, a regression was introduced where we end up
calling addCatalogObject on a CATALOG object type in the second pass
over the catalog objects because the CATALOG object is not considered
a top level object.

The issue is fixed by updating the top level objects in the first pass
and updating the non top level objects and the catalog object in the
second pass.

Testing:
- Verified by manually running "invalidate metadata" and checking that
  there is no exception in the impalad.INFO log file.
- No new tests were added because it is difficult and excessive to
  reproduce the issue in a test.

Change-Id: I7b8e7db2c679ea9bffd8863a3367aa3b94e4e1ed
Reviewed-on: http://gerrit.cloudera.org:8080/7121
Reviewed-by: Taras Bobrovytsky <tbobrovytsky@cloudera.com>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/87a7a641
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/87a7a641
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/87a7a641

Branch: refs/heads/master
Commit: 87a7a6418eacea9e1be6757baa40b6df3f72f4dd
Parents: eea4ad7
Author: Taras Bobrovytsky <tbobrovytsky@cloudera.com>
Authored: Thu Jun 8 14:45:59 2017 -0700
Committer: Impala Public Jenkins <impala-public-jenkins@gerrit.cloudera.org>
Committed: Fri Jun 9 05:16:18 2017 +0000

----------------------------------------------------------------------
 .../org/apache/impala/catalog/ImpaladCatalog.java    | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/87a7a641/fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
----------------------------------------------------------------------
diff --git a/fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java b/fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
index e6826b7..4c959b2 100644
--- a/fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
+++ b/fe/src/main/java/org/apache/impala/catalog/ImpaladCatalog.java
@@ -17,6 +17,8 @@
 
 package org.apache.impala.catalog;
 
+import com.google.common.base.Preconditions;
+
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.hadoop.fs.Path;
@@ -105,7 +107,7 @@ public class ImpaladCatalog extends Catalog {
    * existing in the catalog in order to be added.
    */
   private boolean isTopLevelCatalogObject(TCatalogObject catalogObject) {
-    return catalogObject.getType() == TCatalogObjectType.DATABASE||
+    return catalogObject.getType() == TCatalogObjectType.DATABASE ||
         catalogObject.getType() == TCatalogObjectType.DATA_SOURCE ||
         catalogObject.getType() == TCatalogObjectType.HDFS_CACHE_POOL ||
         catalogObject.getType() == TCatalogObjectType.ROLE;
@@ -144,11 +146,9 @@ public class ImpaladCatalog extends Catalog {
 
     // Process updates to top level objects first because they don't depend on any other
     // objects already existing in the catalog.
-    long newCatalogVersion = lastSyncedCatalogVersion_;
     for (TCatalogObject catalogObject: req.getUpdated_objects()) {
-      if (catalogObject.getType() == TCatalogObjectType.CATALOG) {
-        newCatalogVersion = catalogObject.getCatalog_version();
-      } else if (isTopLevelCatalogObject(catalogObject)) {
+      if (isTopLevelCatalogObject(catalogObject)) {
+        Preconditions.checkState(catalogObject.getType() != TCatalogObjectType.CATALOG);
         try {
           addCatalogObject(catalogObject);
         } catch (Exception e) {
@@ -160,8 +160,11 @@ public class ImpaladCatalog extends Catalog {
     // Process updates to dependent objects next. Since the top level objects were already
     // processed, we are guaranteed that the top level objects that the dependent objects
     // depend on exist in the catalog.
+    long newCatalogVersion = lastSyncedCatalogVersion_;
     for (TCatalogObject catalogObject: req.getUpdated_objects()) {
-      if (!isTopLevelCatalogObject(catalogObject)) {
+      if (catalogObject.getType() == TCatalogObjectType.CATALOG) {
+        newCatalogVersion = catalogObject.getCatalog_version();
+      } else if (!isTopLevelCatalogObject(catalogObject)) {
         try {
           addCatalogObject(catalogObject);
         } catch (Exception e) {


Mime
View raw message