diff --git a/tools/trace_analyzer_tool.cc b/tools/trace_analyzer_tool.cc index 49f2175a3..a01869252 100644 --- a/tools/trace_analyzer_tool.cc +++ b/tools/trace_analyzer_tool.cc @@ -78,6 +78,11 @@ DEFINE_bool(output_time_series, false, "such that we can have the time series data of the queries \n" "File name: ---time_series.txt\n" "Format:[type_id time_in_sec access_keyid]."); +DEFINE_bool(try_process_corrupted_trace, false, + "In default, trace_analyzer will exit if the trace file is " + "corrupted due to the unexpected tracing cases. If this option " + "is enabled, trace_analyzer will stop reading the trace file, " + "and start analyzing the read-in data."); DEFINE_int32(output_prefix_cut, 0, "The number of bytes as prefix to cut the keys.\n" "If it is enabled, it will generate the following:\n" @@ -1943,7 +1948,7 @@ int trace_analyzer_tool(int argc, char** argv) { } s = analyzer->StartProcessing(); - if (!s.ok()) { + if (!s.ok() && !FLAGS_try_process_corrupted_trace) { fprintf(stderr, "%s\n", s.getState()); fprintf(stderr, "Cannot processing the trace\n"); exit(1);