Repository: incubator-impala Updated Branches: refs/heads/master 6596bebe0 -> 5325b1c07
IMPALA-5923: Print binary ID as hex in ChildQuery::Cancel() ChildQuery::Cancel() prints a binary ID into the log which can show up as random characters. One fix is to print it as a hex string. I tested this by running test_cancellation::test_cancel_insert and making sure the ID is printed as hex. This change also removes PrintAsHex() which was broken and unused. Change-Id: Ie1a9516d5c03524e2585255700bb84e8a301a7ee Reviewed-on: http://gerrit.cloudera.org:8080/8050 Reviewed-by: Lars Volker <[email protected]> Tested-by: Impala Public Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/cbf38dcd Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/cbf38dcd Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/cbf38dcd Branch: refs/heads/master Commit: cbf38dcd03ea5abb92d11a9d35e032e2428d299f Parents: 6596beb Author: Lars Volker <[email protected]> Authored: Tue Sep 12 21:34:21 2017 -0700 Committer: Impala Public Jenkins <[email protected]> Committed: Thu Sep 14 00:32:11 2017 +0000 ---------------------------------------------------------------------- be/src/service/child-query.cc | 12 ++++++++++-- be/src/util/debug-util.cc | 9 --------- be/src/util/debug-util.h | 1 - 3 files changed, 10 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/cbf38dcd/be/src/service/child-query.cc ---------------------------------------------------------------------- diff --git a/be/src/service/child-query.cc b/be/src/service/child-query.cc index 21a2b07..58a275b 100644 --- a/be/src/service/child-query.cc +++ b/be/src/service/child-query.cc @@ -128,9 +128,17 @@ void ChildQuery::Cancel() { if (!is_running_) return; is_running_ = false; } - VLOG_QUERY << "Cancelling and closing child query with operation id: " - << hs2_handle_.operationId.guid; + TUniqueId session_id; + TUniqueId secret_unused; // Ignore return statuses because they are not actionable. + Status status = ImpalaServer::THandleIdentifierToTUniqueId(hs2_handle_.operationId, + &session_id, &secret_unused); + if (status.ok()) { + VLOG_QUERY << "Cancelling and closing child query with operation id: " << session_id; + } else { + VLOG_QUERY << "Cancelling and closing child query. Failed to get query id: " << + status; + } TCancelOperationResp cancel_resp; TCancelOperationReq cancel_req; cancel_req.operationHandle = hs2_handle_; http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/cbf38dcd/be/src/util/debug-util.cc ---------------------------------------------------------------------- diff --git a/be/src/util/debug-util.cc b/be/src/util/debug-util.cc index 48df592..1cb61e4 100644 --- a/be/src/util/debug-util.cc +++ b/be/src/util/debug-util.cc @@ -113,15 +113,6 @@ string PrintId(const TUniqueId& id, const string& separator) { return out.str(); } -string PrintAsHex(const char* bytes, int64_t len) { - stringstream out; - out << hex << std::setfill('0'); - for (int i = 0; i < len; ++i) { - out << setw(2) << static_cast<uint16_t>(bytes[i]); - } - return out.str(); -} - bool ParseId(const string& s, TUniqueId* id) { // For backwards compatibility, this method parses two forms of query ID from text: // - <hex-int64_t><colon><hex-int64_t> - this format is the standard going forward http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/cbf38dcd/be/src/util/debug-util.h ---------------------------------------------------------------------- diff --git a/be/src/util/debug-util.h b/be/src/util/debug-util.h index 29fd6bb..27d6cee 100644 --- a/be/src/util/debug-util.h +++ b/be/src/util/debug-util.h @@ -69,7 +69,6 @@ std::string PrintTSessionType(const TSessionType::type& type); std::string PrintTStmtType(const TStmtType::type& type); std::string PrintQueryState(const beeswax::QueryState::type& type); std::string PrintEncoding(const parquet::Encoding::type& type); -std::string PrintAsHex(const char* bytes, int64_t len); std::string PrintTMetricKind(const TMetricKind::type& type); std::string PrintTUnit(const TUnit::type& type); std::string PrintTImpalaQueryOptions(const TImpalaQueryOptions::type& type);
