You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2018/06/15 00:53:46 UTC

[2/2] impala git commit: IMPALA-6835: Add table name and node id to Kudu scanner errors

IMPALA-6835: Add table name and node id to Kudu scanner errors

Previously, the error messages in KuduScanner only contained the
reason for failure. They did not contain the KuduTable name or the
TPlanNode id which made it inconveient to debug. This change adds
the TPlanNode id to all error messages and the KuduTable name
whenever applicable.

This change was manually tested by explicitly returning failure
while scanning kudu tables.

Change-Id: I0377fc8591738dc45092d228fcf292ddbb367825
Reviewed-on: http://gerrit.cloudera.org:8080/10671
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


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

Branch: refs/heads/2.x
Commit: 08d3e10a1b7ed7ed1ee6c10839a8e967559285d7
Parents: f9f2a01
Author: poojanilangekar <po...@cloudera.com>
Authored: Fri Jun 8 17:05:37 2018 -0700
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Thu Jun 14 21:10:19 2018 +0000

----------------------------------------------------------------------
 be/src/exec/kudu-scanner.cc | 37 +++++++++++++++++++++++--------------
 be/src/exec/kudu-scanner.h  |  3 +++
 be/src/exec/kudu-util.h     |  1 +
 3 files changed, 27 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/08d3e10a/be/src/exec/kudu-scanner.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/kudu-scanner.cc b/be/src/exec/kudu-scanner.cc
index 9e90bdb..e63a6fe 100644
--- a/be/src/exec/kudu-scanner.cc
+++ b/be/src/exec/kudu-scanner.cc
@@ -17,11 +17,11 @@
 
 #include "exec/kudu-scanner.h"
 
+#include <string>
+#include <vector>
 #include <kudu/client/row_result.h>
 #include <kudu/client/value.h>
 #include <thrift/protocol/TDebugProtocol.h>
-#include <vector>
-#include <string>
 
 #include "exec/kudu-util.h"
 #include "exprs/scalar-expr.h"
@@ -146,23 +146,26 @@ Status KuduScanner::OpenNextScanToken(const string& scan_token, bool* eos) {
   DCHECK(scanner_ == NULL);
   kudu::client::KuduScanner* scanner;
   KUDU_RETURN_IF_ERROR(kudu::client::KuduScanToken::DeserializeIntoScanner(
-      scan_node_->kudu_client(), scan_token, &scanner),
-      "Unable to deserialize scan token");
+                           scan_node_->kudu_client(), scan_token, &scanner),
+      BuildErrorString("Unable to deserialize scan token"));
   scanner_.reset(scanner);
 
   if (UNLIKELY(FLAGS_pick_only_leaders_for_tests)) {
     KUDU_RETURN_IF_ERROR(scanner_->SetSelection(kudu::client::KuduClient::LEADER_ONLY),
-                         "Could not set replica selection.");
+        BuildErrorString("Could not set replica selection"));
   }
   kudu::client::KuduScanner::ReadMode mode =
       MODE_READ_AT_SNAPSHOT == FLAGS_kudu_read_mode ?
           kudu::client::KuduScanner::READ_AT_SNAPSHOT :
           kudu::client::KuduScanner::READ_LATEST;
-  KUDU_RETURN_IF_ERROR(scanner_->SetReadMode(mode), "Could not set scanner ReadMode");
+  KUDU_RETURN_IF_ERROR(
+      scanner_->SetReadMode(mode), BuildErrorString("Could not set scanner ReadMode"));
   KUDU_RETURN_IF_ERROR(scanner_->SetTimeoutMillis(FLAGS_kudu_operation_timeout_ms),
-      "Could not set scanner timeout");
-  VLOG_ROW << "Starting KuduScanner with ReadMode=" << mode << " timeout=" <<
-      FLAGS_kudu_operation_timeout_ms;
+      BuildErrorString("Could not set scanner timeout"));
+  VLOG_ROW << "Starting KuduScanner with ReadMode=" << mode
+           << " timeout=" << FLAGS_kudu_operation_timeout_ms
+           << " node with id=" << scan_node_->id()
+           << " Kudu table=" << scan_node_->table_->name();
 
   if (!timestamp_slots_.empty()) {
     uint64_t row_format_flags =
@@ -213,14 +216,14 @@ Status KuduScanner::OpenNextScanToken(const string& scan_token, bool* eos) {
           KUDU_RETURN_IF_ERROR(
               scanner_->AddConjunctPredicate(scan_node_->table_->NewComparisonPredicate(
                   col_name, KuduPredicate::ComparisonOp::GREATER_EQUAL, min_value)),
-              "Failed to add min predicate");
+              BuildErrorString("Failed to add min predicate"));
 
           KuduValue* max_value;
           RETURN_IF_ERROR(CreateKuduValue(col_type, max, &max_value));
           KUDU_RETURN_IF_ERROR(
               scanner_->AddConjunctPredicate(scan_node_->table_->NewComparisonPredicate(
                   col_name, KuduPredicate::ComparisonOp::LESS_EQUAL, max_value)),
-              "Failed to add max predicate");
+              BuildErrorString("Failed to add max predicate"));
         }
       }
     }
@@ -228,12 +231,12 @@ Status KuduScanner::OpenNextScanToken(const string& scan_token, bool* eos) {
 
   if (scan_node_->limit() != -1 && conjunct_evals_.empty()) {
     KUDU_RETURN_IF_ERROR(scanner_->SetLimit(scan_node_->limit()),
-        "Failed to set limit on scan.");
+        BuildErrorString("Failed to set limit on scan"));
   }
 
   {
     SCOPED_TIMER(state_->total_storage_wait_timer());
-    KUDU_RETURN_IF_ERROR(scanner_->Open(), "Unable to open scanner");
+    KUDU_RETURN_IF_ERROR(scanner_->Open(), BuildErrorString("Unable to open scanner"));
   }
   *eos = false;
   return Status::OK();
@@ -340,7 +343,8 @@ Status KuduScanner::DecodeRowsIntoRowBatch(RowBatch* row_batch, Tuple** tuple_me
 Status KuduScanner::GetNextScannerBatch() {
   SCOPED_TIMER(state_->total_storage_wait_timer());
   int64_t now = MonotonicMicros();
-  KUDU_RETURN_IF_ERROR(scanner_->NextBatch(&cur_kudu_batch_), "Unable to advance iterator");
+  KUDU_RETURN_IF_ERROR(scanner_->NextBatch(&cur_kudu_batch_),
+      BuildErrorString("Unable to advance iterator"));
   COUNTER_ADD(scan_node_->kudu_round_trips(), 1);
   cur_kudu_batch_num_read_ = 0;
   COUNTER_ADD(scan_node_->rows_read_counter(), cur_kudu_batch_.NumRows());
@@ -348,4 +352,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_->name());
+}
+
 }  // namespace impala

http://git-wip-us.apache.org/repos/asf/impala/blob/08d3e10a/be/src/exec/kudu-scanner.h
----------------------------------------------------------------------
diff --git a/be/src/exec/kudu-scanner.h b/be/src/exec/kudu-scanner.h
index 5617847..2a44725 100644
--- a/be/src/exec/kudu-scanner.h
+++ b/be/src/exec/kudu-scanner.h
@@ -88,6 +88,9 @@ class KuduScanner {
     return reinterpret_cast<Tuple*>(mem + scan_node_->tuple_desc()->byte_size());
   }
 
+  /// Builds the error string by adding the PlanNode id and KuduTable to the message.
+  string BuildErrorString(const char* msg);
+
   KuduScanNodeBase* scan_node_;
   RuntimeState* state_;
 

http://git-wip-us.apache.org/repos/asf/impala/blob/08d3e10a/be/src/exec/kudu-util.h
----------------------------------------------------------------------
diff --git a/be/src/exec/kudu-util.h b/be/src/exec/kudu-util.h
index 9cf2891..8fe4d01 100644
--- a/be/src/exec/kudu-util.h
+++ b/be/src/exec/kudu-util.h
@@ -32,6 +32,7 @@ struct tm;
 namespace impala {
 
 /// Takes a Kudu status and returns an impala one, if it's not OK.
+/// Evaluates the prepend argument only if the status is not OK.
 #define KUDU_RETURN_IF_ERROR(expr, prepend) \
   do { \
     kudu::Status _s = (expr); \