Repository: kudu Updated Branches: refs/heads/master 082bbfe20 -> 117e7d906
client: add tablet id to scanner error messages Some of the existing scanner log messages are confusing because at some point the KuduScanner::Data::DebugString() method was changed to have different output. This patch cleans up the output so that the sentences make sense and so we always print the id of the tablet that returned the error, if it's available. Also fixed a couple of clang-tidy warnings. Change-Id: I349d624c87d924df81d34c5eeb556433eac7b440 Reviewed-on: http://gerrit.cloudera.org:8080/11645 Tested-by: Mike Percy <mpe...@apache.org> Reviewed-by: Will Berkeley <wdberke...@gmail.com> Reviewed-by: Adar Dembo <a...@cloudera.com> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/117e7d90 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/117e7d90 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/117e7d90 Branch: refs/heads/master Commit: 117e7d9065961cebeb86addba1262d3f2741bcc8 Parents: 082bbfe Author: Mike Percy <mpe...@apache.org> Authored: Tue Oct 9 17:15:12 2018 -0700 Committer: Mike Percy <mpe...@apache.org> Committed: Wed Oct 17 23:42:05 2018 +0000 ---------------------------------------------------------------------- src/kudu/client/client.cc | 5 +++-- src/kudu/client/scanner-internal.cc | 16 ++++++++++++---- src/kudu/client/scanner-internal.h | 16 +++++----------- 3 files changed, 20 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/117e7d90/src/kudu/client/client.cc ---------------------------------------------------------------------- diff --git a/src/kudu/client/client.cc b/src/kudu/client/client.cc index 9230a30..1986257 100644 --- a/src/kudu/client/client.cc +++ b/src/kudu/client/client.cc @@ -147,6 +147,7 @@ struct tm; namespace kudu { class simple_spinlock; + namespace client { class ResourceMetrics; @@ -1559,13 +1560,13 @@ Status KuduScanner::NextBatch(KuduScanBatch* batch) { bool needs_reopen = false; Status s = data_->HandleError(result, batch_deadline, &blacklist, &needs_reopen); if (!s.ok()) { - LOG(WARNING) << "Scan at tablet server " << data_->ts_->ToString() << " of tablet " + LOG(WARNING) << "Scan on tablet server " << data_->ts_->ToString() << " with " << data_->DebugString() << " failed: " << result.status.ToString(); return s; } if (data_->configuration().is_fault_tolerant()) { - LOG(WARNING) << "Attempting to retry scan of tablet " << data_->DebugString() + LOG(WARNING) << "Attempting to retry " << data_->DebugString() << " elsewhere."; return data_->ReopenCurrentTablet(batch_deadline, &blacklist); } http://git-wip-us.apache.org/repos/asf/kudu/blob/117e7d90/src/kudu/client/scanner-internal.cc ---------------------------------------------------------------------- diff --git a/src/kudu/client/scanner-internal.cc b/src/kudu/client/scanner-internal.cc index af8f783..51cdca6 100644 --- a/src/kudu/client/scanner-internal.cc +++ b/src/kudu/client/scanner-internal.cc @@ -30,6 +30,7 @@ #include "kudu/client/client-internal.h" #include "kudu/client/meta_cache.h" +#include "kudu/client/schema.h" #include "kudu/common/common.pb.h" #include "kudu/common/encoded_key.h" #include "kudu/common/partition.h" @@ -203,9 +204,17 @@ void KuduScanner::Data::UpdateResourceMetrics() { } } +string KuduScanner::Data::DebugString() const { + return Substitute("Scanner { table: $0, tablet: $1, projection: $2, scan_spec: $3 }", + table_->name(), + remote_ ? remote_->tablet_id() : "<unknown>", + configuration_.projection()->ToString(), + configuration_.spec().ToString(*table_->schema().schema_)); +} + ScanRpcStatus KuduScanner::Data::AnalyzeResponse(const Status& rpc_status, const MonoTime& overall_deadline, - const MonoTime& deadline) { + const MonoTime& rpc_deadline) { if (rpc_status.ok() && !last_response_.has_error()) { return ScanRpcStatus{ScanRpcStatus::OK, Status::OK()}; } @@ -239,11 +248,10 @@ ScanRpcStatus KuduScanner::Data::AnalyzeResponse(const Status& rpc_status, } if (rpc_status.IsTimedOut()) { - if (overall_deadline == deadline) { + if (overall_deadline == rpc_deadline) { return ScanRpcStatus{ScanRpcStatus::OVERALL_DEADLINE_EXCEEDED, rpc_status}; - } else { - return ScanRpcStatus{ScanRpcStatus::RPC_DEADLINE_EXCEEDED, rpc_status}; } + return ScanRpcStatus{ScanRpcStatus::RPC_DEADLINE_EXCEEDED, rpc_status}; } return ScanRpcStatus{ScanRpcStatus::RPC_ERROR, rpc_status}; } http://git-wip-us.apache.org/repos/asf/kudu/blob/117e7d90/src/kudu/client/scanner-internal.h ---------------------------------------------------------------------- diff --git a/src/kudu/client/scanner-internal.h b/src/kudu/client/scanner-internal.h index 9bfdabe..5db5bd9 100644 --- a/src/kudu/client/scanner-internal.h +++ b/src/kudu/client/scanner-internal.h @@ -32,15 +32,11 @@ #include "kudu/client/row_result.h" #include "kudu/client/scan_batch.h" #include "kudu/client/scan_configuration.h" -#include "kudu/client/schema.h" #include "kudu/client/shared_ptr.h" #include "kudu/common/partition_pruner.h" -#include "kudu/common/scan_spec.h" -#include "kudu/common/schema.h" #include "kudu/common/wire_protocol.pb.h" #include "kudu/gutil/macros.h" #include "kudu/gutil/ref_counted.h" -#include "kudu/gutil/strings/substitute.h" #include "kudu/rpc/rpc_controller.h" #include "kudu/tserver/tserver.pb.h" #include "kudu/util/slice.h" @@ -49,13 +45,16 @@ namespace kudu { class MonoTime; +class Schema; namespace tserver { class TabletServerServiceProxy; -} +} // tserver namespace client { +class KuduSchema; + namespace internal { class RemoteTablet; class RemoteTabletServer; @@ -260,12 +259,7 @@ class KuduScanner::Data { // // This method will not return sensitive predicate information, so it's // suitable for use in client-side logging (as opposed to Scanner::ToString). - std::string DebugString() const { - return strings::Substitute("Scanner { table: $0, projection: $1, scan_spec: $2 }", - table_->name(), - configuration_.projection()->ToString(), - configuration_.spec().ToString(*table_->schema().schema_)); - } + std::string DebugString() const; private: // Analyze the response of the last Scan RPC made by this scanner.