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

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

commit 16eaedf4e5e74d961d2ffe1a4b1818f8087e6e97
Author: Riza Suminto <[email protected]>
AuthorDate: Fri May 16 08:24:44 2025 -0700

    IMPALA-13850 (part 3): Fix TSAN issue at AcceptRequest
    
    Nightly TSAN build reveal issue in part 2 patch. This patch attempt to
    fix is by changing the boolean variable into AtomicBoolean.
    
    Testing:
    Pass TSAN core tests.
    
    Change-Id: I8dcd3c8e105d8dc6ac04096060dbf6e185651aa5
    Reviewed-on: http://gerrit.cloudera.org:8080/22907
    Reviewed-by: Joe McDonnell <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 be/src/catalog/catalog-server.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/be/src/catalog/catalog-server.cc b/be/src/catalog/catalog-server.cc
index 875853e0b..afeaf9011 100644
--- a/be/src/catalog/catalog-server.cc
+++ b/be/src/catalog/catalog-server.cc
@@ -550,7 +550,7 @@ class CatalogServiceThriftIf : public CatalogServiceIf {
  private:
   CatalogServer* catalog_server_;
   string server_address_;
-  bool has_initiated_first_reset_ = false;
+  AtomicBool has_initiated_first_reset_{false};
 
   // Check if catalog protocols are compatible between client and catalog 
server.
   // Return Status::OK() if the protocols are compatible and catalog server is 
active.
@@ -563,12 +563,14 @@ class CatalogServiceThriftIf : public CatalogServiceIf {
       status = Status(Substitute("Request for Catalog service is rejected 
since "
           "catalogd $0 is in standby mode", server_address_));
     }
-    while (status.ok() && !has_initiated_first_reset_) {
+    if (!status.ok()) return status;
+
+    while (!has_initiated_first_reset_.Load()) {
       long current_catalog_version = 0;
       status = 
catalog_server_->catalog()->GetCatalogVersion(&current_catalog_version);
       if (!status.ok()) break;
       if (current_catalog_version >= MIN_CATALOG_VERSION_TO_ACCEPT_REQUEST) {
-        has_initiated_first_reset_ = true;
+        has_initiated_first_reset_.Store(true);
       } else {
         VLOG(1) << "Catalog is not initialized yet. Waiting for catalog 
version ("
                 << current_catalog_version << ") to be >= "

Reply via email to