Merge pull request #1347 from atn34/fix-fdbcli-trace-format

Fix fdbcli and fdbbackup --trace_format option
This commit is contained in:
A.J. Beamon 2019-03-26 09:13:41 -07:00 committed by GitHub
commit c3e7611415
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -2673,6 +2673,7 @@ int main(int argc, char* argv[]) {
bool quietDisplay = false; bool quietDisplay = false;
bool dryRun = false; bool dryRun = false;
std::string traceDir = ""; std::string traceDir = "";
std::string traceFormat = "";
std::string traceLogGroup; std::string traceLogGroup;
uint64_t traceRollSize = TRACE_DEFAULT_ROLL_SIZE; uint64_t traceRollSize = TRACE_DEFAULT_ROLL_SIZE;
uint64_t traceMaxLogsSize = TRACE_DEFAULT_MAX_LOGS_SIZE; uint64_t traceMaxLogsSize = TRACE_DEFAULT_MAX_LOGS_SIZE;
@ -2778,9 +2779,10 @@ int main(int argc, char* argv[]) {
traceDir = args->OptionArg(); traceDir = args->OptionArg();
break; break;
case OPT_TRACE_FORMAT: case OPT_TRACE_FORMAT:
if (!selectTraceFormatter(args->OptionArg())) { if (!validateTraceFormat(args->OptionArg())) {
fprintf(stderr, "WARNING: Unrecognized trace format `%s'\n", args->OptionArg()); fprintf(stderr, "WARNING: Unrecognized trace format `%s'\n", args->OptionArg());
} }
traceFormat = args->OptionArg();
break; break;
case OPT_TRACE_LOG_GROUP: case OPT_TRACE_LOG_GROUP:
traceLogGroup = args->OptionArg(); traceLogGroup = args->OptionArg();
@ -3121,6 +3123,9 @@ int main(int argc, char* argv[]) {
setNetworkOption(FDBNetworkOptions::TRACE_ENABLE); setNetworkOption(FDBNetworkOptions::TRACE_ENABLE);
else else
setNetworkOption(FDBNetworkOptions::TRACE_ENABLE, StringRef(traceDir)); setNetworkOption(FDBNetworkOptions::TRACE_ENABLE, StringRef(traceDir));
if (!traceFormat.empty()) {
setNetworkOption(FDBNetworkOptions::TRACE_FORMAT, StringRef(traceFormat));
}
setNetworkOption(FDBNetworkOptions::ENABLE_SLOW_TASK_PROFILING); setNetworkOption(FDBNetworkOptions::ENABLE_SLOW_TASK_PROFILING);
} }

View File

@ -2302,6 +2302,7 @@ struct CLIOptions {
std::string clusterFile; std::string clusterFile;
bool trace; bool trace;
std::string traceDir; std::string traceDir;
std::string traceFormat;
int exit_timeout; int exit_timeout;
Optional<std::string> exec; Optional<std::string> exec;
bool initialStatusCheck; bool initialStatusCheck;
@ -2398,9 +2399,10 @@ struct CLIOptions {
case OPT_STATUS_FROM_JSON: case OPT_STATUS_FROM_JSON:
return printStatusFromJSON(args.OptionArg()); return printStatusFromJSON(args.OptionArg());
case OPT_TRACE_FORMAT: case OPT_TRACE_FORMAT:
if (!selectTraceFormatter(args.OptionArg())) { if (!validateTraceFormat(args.OptionArg())) {
fprintf(stderr, "WARNING: Unrecognized trace format `%s'\n", args.OptionArg()); fprintf(stderr, "WARNING: Unrecognized trace format `%s'\n", args.OptionArg());
} }
traceFormat = args.OptionArg();
break; break;
case OPT_VERSION: case OPT_VERSION:
printVersion(); printVersion();
@ -3395,6 +3397,9 @@ int main(int argc, char **argv) {
else else
setNetworkOption(FDBNetworkOptions::TRACE_ENABLE, StringRef(opt.traceDir)); setNetworkOption(FDBNetworkOptions::TRACE_ENABLE, StringRef(opt.traceDir));
if (!opt.traceFormat.empty()) {
setNetworkOption(FDBNetworkOptions::TRACE_FORMAT, StringRef(opt.traceFormat));
}
setNetworkOption(FDBNetworkOptions::ENABLE_SLOW_TASK_PROFILING); setNetworkOption(FDBNetworkOptions::ENABLE_SLOW_TASK_PROFILING);
} }