Repository: impala Updated Branches: refs/heads/master bbb399ddf -> e6abf8e86
IMPALA-7210: global debug actions should be case insensitive The ExecNode debug actions don't care about case so better to be consistent. Testing: verify that this works: set debug_action=coord_before_exec_rpc:sleep@1000 Change-Id: Ia3f738caeb602afce4ca638ce354302e521187dc Reviewed-on: http://gerrit.cloudera.org:8080/10814 Reviewed-by: Dan Hecht <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/impala/repo Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/aebec1cf Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/aebec1cf Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/aebec1cf Branch: refs/heads/master Commit: aebec1cf8705f590b8b3fa54a1ef412802d75a07 Parents: bbb399d Author: Dan Hecht <[email protected]> Authored: Mon Jun 25 14:46:48 2018 -0700 Committer: Impala Public Jenkins <[email protected]> Committed: Tue Jun 26 19:00:44 2018 +0000 ---------------------------------------------------------------------- be/src/util/debug-util.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/impala/blob/aebec1cf/be/src/util/debug-util.cc ---------------------------------------------------------------------- diff --git a/be/src/util/debug-util.cc b/be/src/util/debug-util.cc index f305943..052d70d 100644 --- a/be/src/util/debug-util.cc +++ b/be/src/util/debug-util.cc @@ -20,6 +20,7 @@ #include <iomanip> #include <random> #include <sstream> +#include <boost/algorithm/string.hpp> #include <boost/tokenizer.hpp> #include "common/version.h" @@ -42,6 +43,7 @@ extern void DumpStackTraceToString(std::string* s); #include "common/names.h" +using boost::algorithm::iequals; using boost::char_separator; using boost::is_any_of; using boost::split; @@ -330,20 +332,21 @@ Status DebugActionImpl( query_options.debug_action); static const char ERROR_MSG[] = "Invalid debug_action $0:$1 ($2)"; for (const vector<string>& components : action_list) { - if (components.size() != 2 || components[0].compare(label) != 0) continue; + // size() != 2 check filters out ExecNode debug actions. + if (components.size() != 2 || !iequals(components[0], label)) continue; // 'tokens' becomes {command, param0, param1, ... } vector<string> tokens = TokenizeDebugActionParams(components[1]); DCHECK_GE(tokens.size(), 1); const string& cmd = tokens[0]; int sleep_millis = 0; - if (cmd.compare("SLEEP") == 0) { + if (iequals(cmd, "SLEEP")) { // SLEEP@<millis> if (tokens.size() != 2) { return Status(Substitute(ERROR_MSG, components[0], components[1], "expected SLEEP@<ms>")); } sleep_millis = atoi(tokens[1].c_str()); - } else if (cmd.compare("JITTER") == 0) { + } else if (iequals(cmd, "JITTER")) { // JITTER@<millis>[@<probability>} if (tokens.size() < 2 || tokens.size() > 3) { return Status(Substitute(ERROR_MSG, components[0], components[1], @@ -359,7 +362,7 @@ Status DebugActionImpl( if (!should_execute) continue; } sleep_millis = rand() % (max_millis + 1); - } else if (cmd.compare("FAIL") == 0) { + } else if (iequals(cmd, "FAIL")) { // FAIL[@<probability>] if (tokens.size() > 2) { return Status(Substitute(ERROR_MSG, components[0], components[1],
