From df035b6826e95d22771001cddda9050d0a0a42d9 Mon Sep 17 00:00:00 2001 From: Aaron Gao Date: Tue, 9 May 2017 15:44:48 -0700 Subject: [PATCH] Print compaction_options_universal.stop_style in LOG file Summary: Print compaction_options_universal.stop_style in LOG file ./db_bench --benchmarks=fillseq and read the log Closes https://github.com/facebook/rocksdb/pull/2268 Differential Revision: D5032438 Pulled By: lightmark fbshipit-source-id: 0e72fcd96a1caaf3cab20e86d39c75fbebf5ce37 --- options/options.cc | 19 ++++++++++++++++--- options/options_helper.h | 5 +++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/options/options.cc b/options/options.cc index b668c00c7c..84c78f6f35 100644 --- a/options/options.cc +++ b/options/options.cc @@ -312,7 +312,7 @@ void ColumnFamilyOptions::Dump(Logger* log) const { str_compaction_style = it_compaction_style->second; } ROCKS_LOG_HEADER(log, - " Options.compaction_style: %s", + " Options.compaction_style: %s", str_compaction_style.c_str()); const auto& it_compaction_pri = @@ -325,10 +325,10 @@ void ColumnFamilyOptions::Dump(Logger* log) const { str_compaction_pri = it_compaction_pri->second; } ROCKS_LOG_HEADER(log, - " Options.compaction_pri: %s", + " Options.compaction_pri: %s", str_compaction_pri.c_str()); ROCKS_LOG_HEADER(log, - " Options.compaction_options_universal.size_ratio: %u", + "Options.compaction_options_universal.size_ratio: %u", compaction_options_universal.size_ratio); ROCKS_LOG_HEADER(log, "Options.compaction_options_universal.min_merge_width: %u", @@ -345,6 +345,19 @@ void ColumnFamilyOptions::Dump(Logger* log) const { log, "Options.compaction_options_universal.compression_size_percent: %d", compaction_options_universal.compression_size_percent); + const auto& it_compaction_stop_style = compaction_stop_style_to_string.find( + compaction_options_universal.stop_style); + std::string str_compaction_stop_style; + if (it_compaction_stop_style == compaction_stop_style_to_string.end()) { + assert(false); + str_compaction_stop_style = + "unknown_" + std::to_string(compaction_options_universal.stop_style); + } else { + str_compaction_stop_style = it_compaction_stop_style->second; + } + ROCKS_LOG_HEADER(log, + "Options.compaction_options_universal.stop_style: %s", + str_compaction_stop_style.c_str()); ROCKS_LOG_HEADER( log, "Options.compaction_options_fifo.max_table_files_size: %" PRIu64, compaction_options_fifo.max_table_files_size); diff --git a/options/options_helper.h b/options/options_helper.h index 97630a0a6a..f41a3f0a50 100644 --- a/options/options_helper.h +++ b/options/options_helper.h @@ -37,6 +37,11 @@ static std::map compaction_pri_to_string = { {kOldestSmallestSeqFirst, "kOldestSmallestSeqFirst"}, {kMinOverlappingRatio, "kMinOverlappingRatio"}}; +static std::map + compaction_stop_style_to_string = { + {kCompactionStopStyleSimilarSize, "kCompactionStopStyleSimilarSize"}, + {kCompactionStopStyleTotalSize, "kCompactionStopStyleTotalSize"}}; + #ifndef ROCKSDB_LITE Status GetMutableOptionsFromStrings(