You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2023/03/22 16:19:50 UTC

[impala] 01/03: IMPALA-12014 warning on failed KeepAlive for Kudu scanner

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

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

commit 65ae5febee868addafb56b01f9276a03601dd039
Author: Alexey Serbin <as...@cloudera.com>
AuthorDate: Tue Mar 21 12:40:51 2023 -0700

    IMPALA-12014 warning on failed KeepAlive for Kudu scanner
    
    With this patch, there is now a warning message output when
    ScannerKeepAlive RPC for a Kudu scanner fails.  To avoid flooding the
    log with those messages, KLOG_EVERY_N_SECS(WARNING, 60) is used.
    
    I also updated the signature of the KuduScanner::BuildErrorString()
    method to become a constant one.
    
    This is a follow-up to IMPALA-3292.
    
    Change-Id: If39f968685797506491d3d5ebc481efb6e43a568
    Reviewed-on: http://gerrit.cloudera.org:8080/19643
    Reviewed-by: Wenzhe Zhou <wz...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
    Reviewed-by: Michael Smith <mi...@cloudera.com>
---
 be/src/exec/kudu/kudu-scanner.cc | 15 ++++++++++-----
 be/src/exec/kudu/kudu-scanner.h  |  2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/be/src/exec/kudu/kudu-scanner.cc b/be/src/exec/kudu/kudu-scanner.cc
index 62353eea4..c05367012 100644
--- a/be/src/exec/kudu/kudu-scanner.cc
+++ b/be/src/exec/kudu/kudu-scanner.cc
@@ -20,6 +20,7 @@
 #include <string>
 #include <vector>
 
+#include <glog/logging.h>
 #include <kudu/client/resource_metrics.h>
 #include <kudu/client/row_result.h>
 #include <kudu/client/value.h>
@@ -34,6 +35,7 @@
 #include "gutil/gscoped_ptr.h"
 #include "gutil/strings/substitute.h"
 #include "kudu/util/block_bloom_filter.h"
+#include "kudu/util/logging.h"
 #include "kudu/util/slice.h"
 #include "runtime/mem-pool.h"
 #include "runtime/mem-tracker.h"
@@ -93,7 +95,9 @@ Status KuduScanner::Open() {
 }
 
 void KuduScanner::KeepKuduScannerAlive() {
-  if (scanner_ == nullptr) return;
+  if (scanner_ == nullptr) {
+    return;
+  }
   int64_t now = MonotonicMicros();
   int64_t keepalive_us = FLAGS_kudu_scanner_keep_alive_period_sec * 1e6;
   if (now < last_alive_time_micros_ + keepalive_us) {
@@ -106,7 +110,8 @@ void KuduScanner::KeepKuduScannerAlive() {
   // if the scan is unrecoverable.
   kudu::Status s = scanner_->KeepAlive();
   if (!s.ok()) {
-    VLOG(1) << "Unable to keep the Kudu scanner alive: " << s.ToString();
+    KLOG_EVERY_N_SECS(WARNING, 60) << BuildErrorString(
+        Substitute("$0: unable to keep scanner alive", s.ToString()).c_str());
     return;
   }
   last_alive_time_micros_ = now;
@@ -453,9 +458,9 @@ Status KuduScanner::GetNextScannerBatch() {
   return Status::OK();
 }
 
-string KuduScanner::BuildErrorString(const char* msg) {
-  return Substitute("$0 for node with id '$1' for Kudu table '$2'", msg, scan_node_->id(),
-      scan_node_->table_desc()->table_name());
+string KuduScanner::BuildErrorString(const char* msg) const {
+  return Substitute("$0 for node with id '$1' for Kudu table '$2'",
+      msg, scan_node_->id(), scan_node_->table_desc()->table_name());
 }
 
 }  // namespace impala
diff --git a/be/src/exec/kudu/kudu-scanner.h b/be/src/exec/kudu/kudu-scanner.h
index 0fcce2e83..1250e19ab 100644
--- a/be/src/exec/kudu/kudu-scanner.h
+++ b/be/src/exec/kudu/kudu-scanner.h
@@ -94,7 +94,7 @@ class KuduScanner {
   }
 
   /// Builds the error string by adding the PlanNode id and KuduTable to the message.
-  std::string BuildErrorString(const char* msg);
+  std::string BuildErrorString(const char* msg) const;
 
   KuduScanNodeBase* scan_node_;
   RuntimeState* state_;