From 39eff8c5696206839addf8bcd649ec92f42aaa78 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Tue, 3 Aug 2021 09:43:42 -0700 Subject: [PATCH] Add trace_partial_file_suffix network option --- .../unit/trace_partial_file_suffix_test.cpp | 5 ++-- fdbclient/NativeAPI.actor.cpp | 7 +++++- fdbclient/NativeAPI.actor.h | 1 + fdbclient/vexillographer/fdb.options | 3 +++ flow/FileTraceLogWriter.cpp | 23 +++++++++++++++---- flow/FileTraceLogWriter.h | 3 +++ flow/Trace.cpp | 12 +++++++--- flow/Trace.h | 3 ++- 8 files changed, 44 insertions(+), 13 deletions(-) diff --git a/bindings/c/test/unit/trace_partial_file_suffix_test.cpp b/bindings/c/test/unit/trace_partial_file_suffix_test.cpp index d3be3c79e7..6462d84f5b 100644 --- a/bindings/c/test/unit/trace_partial_file_suffix_test.cpp +++ b/bindings/c/test/unit/trace_partial_file_suffix_test.cpp @@ -53,12 +53,11 @@ int main(int argc, char** argv) { fdb_check(fdb_select_api_version(710)); std::string file_identifier = "trace_partial_file_suffix_test" + std::to_string(std::random_device{}()); - // std::string trace_partial_file_suffix = ".tmp"; - std::string trace_partial_file_suffix = ""; + std::string trace_partial_file_suffix = ".tmp"; set_net_opt(FDBNetworkOption::FDB_NET_OPTION_TRACE_ENABLE, ""); set_net_opt(FDBNetworkOption::FDB_NET_OPTION_TRACE_FILE_IDENTIFIER, file_identifier); - // set_net_opt(FDBNetworkOption::FDB_NET_OPTION_TRACE_PARTIAL_FILE_SUFFIX, trace_partial_file_suffix); + set_net_opt(FDBNetworkOption::FDB_NET_OPTION_TRACE_PARTIAL_FILE_SUFFIX, trace_partial_file_suffix); fdb_check(fdb_setup_network()); std::thread network_thread{ &fdb_run_network }; diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index 0d05f33c58..0a6a474249 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -1698,7 +1698,8 @@ Database Database::createDatabase(Reference connFile, networkOptions.traceDirectory.get(), "trace", networkOptions.traceLogGroup, - networkOptions.traceFileIdentifier); + networkOptions.traceFileIdentifier, + networkOptions.tracePartialFileSuffix); TraceEvent("ClientStart") .detail("SourceVersion", getSourceVersion()) @@ -1856,6 +1857,10 @@ void setNetworkOption(FDBNetworkOptions::Option option, Optional valu throw invalid_option_value(); } break; + case FDBNetworkOptions::TRACE_PARTIAL_FILE_SUFFIX: + validateOptionValuePresent(value); + networkOptions.tracePartialFileSuffix = value.get().toString(); + break; case FDBNetworkOptions::KNOB: { validateOptionValuePresent(value); diff --git a/fdbclient/NativeAPI.actor.h b/fdbclient/NativeAPI.actor.h index e671bac8c1..3636b30c46 100644 --- a/fdbclient/NativeAPI.actor.h +++ b/fdbclient/NativeAPI.actor.h @@ -68,6 +68,7 @@ struct NetworkOptions { std::string traceFormat; std::string traceClockSource; std::string traceFileIdentifier; + std::string tracePartialFileSuffix; Optional logClientInfo; Reference>>> supportedVersions; bool runLoopProfilingEnabled; diff --git a/fdbclient/vexillographer/fdb.options b/fdbclient/vexillographer/fdb.options index e0f908a69c..27fa43aa8f 100644 --- a/fdbclient/vexillographer/fdb.options +++ b/fdbclient/vexillographer/fdb.options @@ -57,6 +57,9 @@ description is not currently required but encouraged.