You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by bh...@apache.org on 2019/02/21 23:50:54 UTC

[impala] 03/04: IMPALA-6900: Fix the min version invariant for invalidate metadata

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

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

commit 4ed947365447934c55eeec94610a2b3cbd993937
Author: Bharath Vissapragada <bh...@cloudera.com>
AuthorDate: Thu Feb 21 00:00:37 2019 -0800

    IMPALA-6900: Fix the min version invariant for invalidate metadata
    
    Current flow of invalidate metadata is as follows.
    
    1. Catalog server records the global catalog version *before* reset()
    2. Catalog server invalidates all the metadata.
    3. Catalog server returns the version recorded in step (1)
    4. Coordinator should wait until the minimum version across all the
       local catalog objects is > the version returned in the step (3).
    
    However, the invariant in step 4 on the coordinator side was incorrectly
    coded resulting in an early termination of the wait loop.
    This breaks the invalidate metadata contract and the subsequent queries
    can fail while resolving catalog objects in the local cache.
    
    Testing: I could reproduce this issue reliably on a pristine HMS with
    high --statestore_update_frequency_ms (see IMPALA-7605 for details).
    With the patch, I'm not able to reproduce it.
    
    Change-Id: I22ace3f5917b6167af63c3dfd2620e69ce8ec1cb
    Reviewed-on: http://gerrit.cloudera.org:8080/12547
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/src/service/impala-server.cc | 6 +++---
 be/src/service/impala-server.h  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/be/src/service/impala-server.cc b/be/src/service/impala-server.cc
index c2705d6..fda10bf 100644
--- a/be/src/service/impala-server.cc
+++ b/be/src/service/impala-server.cc
@@ -1644,10 +1644,10 @@ void ImpalaServer::WaitForMinCatalogUpdate(const int64_t min_req_catalog_object_
       catalog_update_info_.min_catalog_object_version;
   // TODO: Set a timeout to eventually break out of this loop is something goes
   // wrong?
-  VLOG_QUERY << "Waiting for minimum catalog object version: "
-      << min_req_catalog_object_version << " current version: "
+  VLOG_QUERY << "Waiting for local minimum catalog object version to be > "
+      << min_req_catalog_object_version << ", current local minimum version: "
       << min_catalog_object_version;
-  while (catalog_update_info_.min_catalog_object_version < min_req_catalog_object_version
+  while (catalog_update_info_.min_catalog_object_version <= min_req_catalog_object_version
       && catalog_update_info_.catalog_service_id == catalog_service_id) {
     catalog_version_update_cv_.Wait(unique_lock);
   }
diff --git a/be/src/service/impala-server.h b/be/src/service/impala-server.h
index c23714b..6d4704c 100644
--- a/be/src/service/impala-server.h
+++ b/be/src/service/impala-server.h
@@ -367,7 +367,7 @@ class ImpalaServer : public ImpalaServiceIf,
       const TUniqueId& catalog_service_id);
 
   /// Wait until the minimum catalog object version in the local cache is
-  /// greater than or equal to 'min_catalog_update_version' or until the catalog
+  /// greater than 'min_catalog_update_version' or until the catalog
   /// service id has changed.
   void WaitForMinCatalogUpdate(const int64_t min_catalog_update_version,
       const TUniqueId& catalog_service_id);