From dc81efe415a0a7885dfd91b9d6ac6a363a39103b Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Fri, 22 May 2015 11:54:59 -0700 Subject: [PATCH] Change the log-level of DB summary and options from INFO_LEVEL to WARN_LEVEL Summary: Change the log-level of DB summary and options from INFO_LEVEL to WARN_LEVEL Test Plan: Use db_bench to verify the log level. Sample output: 2015/05/22-00:20:39.778064 7fff75b41300 [WARN] RocksDB version: 3.11.0 2015/05/22-00:20:39.778095 7fff75b41300 [WARN] Git sha rocksdb_build_git_sha:7fee8775a459134c4cb04baae5bd1687e268f2a0 2015/05/22-00:20:39.778099 7fff75b41300 [WARN] Compile date May 22 2015 2015/05/22-00:20:39.778101 7fff75b41300 [WARN] DB SUMMARY 2015/05/22-00:20:39.778145 7fff75b41300 [WARN] SST files in /tmp/rocksdbtest-691931916/dbbench dir, Total Num: 0, files: 2015/05/22-00:20:39.778148 7fff75b41300 [WARN] Write Ahead Log file in /tmp/rocksdbtest-691931916/dbbench: 2015/05/22-00:20:39.778150 7fff75b41300 [WARN] Options.error_if_exists: 0 2015/05/22-00:20:39.778152 7fff75b41300 [WARN] Options.create_if_missing: 1 2015/05/22-00:20:39.778153 7fff75b41300 [WARN] Options.paranoid_checks: 1 Reviewers: MarkCallaghan, igor, kradhakrishnan Reviewed By: igor Subscribers: sdong, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D38835 --- db/db_impl.cc | 7 +- util/db_info_dumper.cc | 20 ++--- util/options.cc | 194 ++++++++++++++++++++--------------------- 3 files changed, 110 insertions(+), 111 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index 7b8ffa04e..02e10b4b9 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -4190,12 +4190,11 @@ void DumpRocksDBBuildVersion(Logger * log) { #if !defined(IOS_CROSS_COMPILE) // if we compile with Xcode, we don't run build_detect_vesion, so we don't // generate util/build_version.cc - Log(InfoLogLevel::INFO_LEVEL, log, + Warn(log, "RocksDB version: %d.%d.%d\n", ROCKSDB_MAJOR, ROCKSDB_MINOR, ROCKSDB_PATCH); - Log(InfoLogLevel::INFO_LEVEL, log, "Git sha %s", rocksdb_build_git_sha); - Log(InfoLogLevel::INFO_LEVEL, log, "Compile date %s", - rocksdb_build_compile_date); + Warn(log, "Git sha %s", rocksdb_build_git_sha); + Warn(log, "Compile date %s", rocksdb_build_compile_date); #endif } diff --git a/util/db_info_dumper.cc b/util/db_info_dumper.cc index 9c709282c..7b77b12b4 100644 --- a/util/db_info_dumper.cc +++ b/util/db_info_dumper.cc @@ -34,11 +34,11 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { uint64_t file_size; std::string file_info, wal_info; - Log(InfoLogLevel::INFO_LEVEL, options.info_log, "DB SUMMARY\n"); + Warn(options.info_log, "DB SUMMARY\n"); // Get files in dbname dir if (!env->GetChildren(dbname, &files).ok()) { - Log(InfoLogLevel::ERROR_LEVEL, - options.info_log, "Error when reading %s dir\n", dbname.c_str()); + Error(options.info_log, + "Error when reading %s dir\n", dbname.c_str()); } std::sort(files.begin(), files.end()); for (std::string file : files) { @@ -47,16 +47,16 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { } switch (type) { case kCurrentFile: - Log(InfoLogLevel::INFO_LEVEL, options.info_log, + Warn(options.info_log, "CURRENT file: %s\n", file.c_str()); break; case kIdentityFile: - Log(InfoLogLevel::INFO_LEVEL, options.info_log, + Warn(options.info_log, "IDENTITY file: %s\n", file.c_str()); break; case kDescriptorFile: env->GetFileSize(dbname + "/" + file, &file_size); - Log(InfoLogLevel::INFO_LEVEL, options.info_log, + Warn(options.info_log, "MANIFEST file: %s size: %" PRIu64 " Bytes\n", file.c_str(), file_size); break; @@ -81,7 +81,7 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { for (auto& db_path : options.db_paths) { if (dbname.compare(db_path.path) != 0) { if (!env->GetChildren(db_path.path, &files).ok()) { - Log(InfoLogLevel::ERROR_LEVEL, options.info_log, + Error(options.info_log, "Error when reading %s dir\n", db_path.path.c_str()); continue; @@ -95,7 +95,7 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { } } } - Log(InfoLogLevel::INFO_LEVEL, options.info_log, + Warn(options.info_log, "SST files in %s dir, Total Num: %" PRIu64 ", files: %s\n", db_path.path.c_str(), file_num, file_info.c_str()); file_num = 0; @@ -105,7 +105,7 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { // Get wal file in wal_dir if (dbname.compare(options.wal_dir) != 0) { if (!env->GetChildren(options.wal_dir, &files).ok()) { - Log(InfoLogLevel::ERROR_LEVEL, options.info_log, + Error(options.info_log, "Error when reading %s dir\n", options.wal_dir.c_str()); return; @@ -123,7 +123,7 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { } } } - Log(InfoLogLevel::INFO_LEVEL, options.info_log, + Warn(options.info_log, "Write Ahead Log file in %s: %s\n", options.wal_dir.c_str(), wal_info.c_str()); } diff --git a/util/options.cc b/util/options.cc index 083de0308..404140e25 100644 --- a/util/options.cc +++ b/util/options.cc @@ -307,197 +307,197 @@ static const char* const access_hints[] = { }; void DBOptions::Dump(Logger* log) const { - Log(log," Options.error_if_exists: %d", error_if_exists); - Log(log," Options.create_if_missing: %d", create_if_missing); - Log(log," Options.paranoid_checks: %d", paranoid_checks); - Log(log," Options.env: %p", env); - Log(log," Options.info_log: %p", info_log.get()); - Log(log," Options.max_open_files: %d", max_open_files); - Log(log," Options.max_total_wal_size: %" PRIu64, max_total_wal_size); - Log(log, " Options.disableDataSync: %d", disableDataSync); - Log(log, " Options.use_fsync: %d", use_fsync); - Log(log, " Options.max_log_file_size: %zu", max_log_file_size); - Log(log, "Options.max_manifest_file_size: %" PRIu64, + Warn(log, " Options.error_if_exists: %d", error_if_exists); + Warn(log, " Options.create_if_missing: %d", create_if_missing); + Warn(log, " Options.paranoid_checks: %d", paranoid_checks); + Warn(log, " Options.env: %p", env); + Warn(log, " Options.info_log: %p", info_log.get()); + Warn(log, " Options.max_open_files: %d", max_open_files); + Warn(log, " Options.max_total_wal_size: %" PRIu64, max_total_wal_size); + Warn(log, " Options.disableDataSync: %d", disableDataSync); + Warn(log, " Options.use_fsync: %d", use_fsync); + Warn(log, " Options.max_log_file_size: %zu", max_log_file_size); + Warn(log, "Options.max_manifest_file_size: %" PRIu64, max_manifest_file_size); - Log(log, " Options.log_file_time_to_roll: %zu", log_file_time_to_roll); - Log(log, " Options.keep_log_file_num: %zu", keep_log_file_num); - Log(log, " Options.allow_os_buffer: %d", allow_os_buffer); - Log(log, " Options.allow_mmap_reads: %d", allow_mmap_reads); - Log(log, " Options.allow_mmap_writes: %d", allow_mmap_writes); - Log(log, " Options.create_missing_column_families: %d", + Warn(log, " Options.log_file_time_to_roll: %zu", log_file_time_to_roll); + Warn(log, " Options.keep_log_file_num: %zu", keep_log_file_num); + Warn(log, " Options.allow_os_buffer: %d", allow_os_buffer); + Warn(log, " Options.allow_mmap_reads: %d", allow_mmap_reads); + Warn(log, " Options.allow_mmap_writes: %d", allow_mmap_writes); + Warn(log, " Options.create_missing_column_families: %d", create_missing_column_families); - Log(log, " Options.db_log_dir: %s", + Warn(log, " Options.db_log_dir: %s", db_log_dir.c_str()); - Log(log, " Options.wal_dir: %s", + Warn(log, " Options.wal_dir: %s", wal_dir.c_str()); - Log(log, " Options.table_cache_numshardbits: %d", + Warn(log, " Options.table_cache_numshardbits: %d", table_cache_numshardbits); - Log(log, " Options.delete_obsolete_files_period_micros: %" PRIu64, + Warn(log, " Options.delete_obsolete_files_period_micros: %" PRIu64, delete_obsolete_files_period_micros); - Log(log, " Options.max_background_compactions: %d", + Warn(log, " Options.max_background_compactions: %d", max_background_compactions); - Log(log, " Options.max_background_flushes: %d", + Warn(log, " Options.max_background_flushes: %d", max_background_flushes); - Log(log, " Options.WAL_ttl_seconds: %" PRIu64, + Warn(log, " Options.WAL_ttl_seconds: %" PRIu64, WAL_ttl_seconds); - Log(log, " Options.WAL_size_limit_MB: %" PRIu64, + Warn(log, " Options.WAL_size_limit_MB: %" PRIu64, WAL_size_limit_MB); - Log(log, " Options.manifest_preallocation_size: %zu", + Warn(log, " Options.manifest_preallocation_size: %zu", manifest_preallocation_size); - Log(log, " Options.allow_os_buffer: %d", + Warn(log, " Options.allow_os_buffer: %d", allow_os_buffer); - Log(log, " Options.allow_mmap_reads: %d", + Warn(log, " Options.allow_mmap_reads: %d", allow_mmap_reads); - Log(log, " Options.allow_mmap_writes: %d", + Warn(log, " Options.allow_mmap_writes: %d", allow_mmap_writes); - Log(log, " Options.is_fd_close_on_exec: %d", + Warn(log, " Options.is_fd_close_on_exec: %d", is_fd_close_on_exec); - Log(log, " Options.stats_dump_period_sec: %u", + Warn(log, " Options.stats_dump_period_sec: %u", stats_dump_period_sec); - Log(log, " Options.advise_random_on_open: %d", + Warn(log, " Options.advise_random_on_open: %d", advise_random_on_open); - Log(log, " Options.db_write_buffer_size: %zd", + Warn(log, " Options.db_write_buffer_size: %zd", db_write_buffer_size); - Log(log, " Options.access_hint_on_compaction_start: %s", + Warn(log, " Options.access_hint_on_compaction_start: %s", access_hints[access_hint_on_compaction_start]); - Log(log, " Options.use_adaptive_mutex: %d", + Warn(log, " Options.use_adaptive_mutex: %d", use_adaptive_mutex); - Log(log, " Options.rate_limiter: %p", + Warn(log, " Options.rate_limiter: %p", rate_limiter.get()); - Log(log, " Options.bytes_per_sync: %" PRIu64, + Warn(log, " Options.bytes_per_sync: %" PRIu64, bytes_per_sync); - Log(log, " Options.wal_bytes_per_sync: %" PRIu64, + Warn(log, " Options.wal_bytes_per_sync: %" PRIu64, wal_bytes_per_sync); - Log(log, " Options.enable_thread_tracking: %d", + Warn(log, " Options.enable_thread_tracking: %d", enable_thread_tracking); } // DBOptions::Dump void ColumnFamilyOptions::Dump(Logger* log) const { - Log(log, " Options.comparator: %s", comparator->Name()); - Log(log, " Options.merge_operator: %s", + Warn(log, " Options.comparator: %s", comparator->Name()); + Warn(log, " Options.merge_operator: %s", merge_operator ? merge_operator->Name() : "None"); - Log(log, " Options.compaction_filter: %s", + Warn(log, " Options.compaction_filter: %s", compaction_filter ? compaction_filter->Name() : "None"); - Log(log, " Options.compaction_filter_factory: %s", + Warn(log, " Options.compaction_filter_factory: %s", compaction_filter_factory->Name()); - Log(log, " Options.compaction_filter_factory_v2: %s", + Warn(log, " Options.compaction_filter_factory_v2: %s", compaction_filter_factory_v2->Name()); - Log(log, " Options.memtable_factory: %s", memtable_factory->Name()); - Log(log, " Options.table_factory: %s", table_factory->Name()); - Log(log, " table_factory options: %s", + Warn(log, " Options.memtable_factory: %s", memtable_factory->Name()); + Warn(log, " Options.table_factory: %s", table_factory->Name()); + Warn(log, " table_factory options: %s", table_factory->GetPrintableTableOptions().c_str()); - Log(log, " Options.write_buffer_size: %zd", write_buffer_size); - Log(log, " Options.max_write_buffer_number: %d", max_write_buffer_number); + Warn(log, " Options.write_buffer_size: %zd", write_buffer_size); + Warn(log, " Options.max_write_buffer_number: %d", max_write_buffer_number); if (!compression_per_level.empty()) { for (unsigned int i = 0; i < compression_per_level.size(); i++) { - Log(log, " Options.compression[%d]: %s", i, + Warn(log, " Options.compression[%d]: %s", i, CompressionTypeToString(compression_per_level[i])); } } else { - Log(log, " Options.compression: %s", + Warn(log, " Options.compression: %s", CompressionTypeToString(compression)); } - Log(log," Options.prefix_extractor: %s", + Warn(log, " Options.prefix_extractor: %s", prefix_extractor == nullptr ? "nullptr" : prefix_extractor->Name()); - Log(log," Options.num_levels: %d", num_levels); - Log(log," Options.min_write_buffer_number_to_merge: %d", + Warn(log, " Options.num_levels: %d", num_levels); + Warn(log, " Options.min_write_buffer_number_to_merge: %d", min_write_buffer_number_to_merge); - Log(log," Options.purge_redundant_kvs_while_flush: %d", + Warn(log, " Options.purge_redundant_kvs_while_flush: %d", purge_redundant_kvs_while_flush); - Log(log," Options.compression_opts.window_bits: %d", + Warn(log, " Options.compression_opts.window_bits: %d", compression_opts.window_bits); - Log(log," Options.compression_opts.level: %d", + Warn(log, " Options.compression_opts.level: %d", compression_opts.level); - Log(log," Options.compression_opts.strategy: %d", + Warn(log, " Options.compression_opts.strategy: %d", compression_opts.strategy); - Log(log," Options.level0_file_num_compaction_trigger: %d", + Warn(log, " Options.level0_file_num_compaction_trigger: %d", level0_file_num_compaction_trigger); - Log(log," Options.level0_slowdown_writes_trigger: %d", + Warn(log, " Options.level0_slowdown_writes_trigger: %d", level0_slowdown_writes_trigger); - Log(log," Options.level0_stop_writes_trigger: %d", + Warn(log, " Options.level0_stop_writes_trigger: %d", level0_stop_writes_trigger); - Log(log," Options.max_mem_compaction_level: %d", + Warn(log, " Options.max_mem_compaction_level: %d", max_mem_compaction_level); - Log(log," Options.target_file_size_base: %" PRIu64, + Warn(log, " Options.target_file_size_base: %" PRIu64, target_file_size_base); - Log(log," Options.target_file_size_multiplier: %d", + Warn(log, " Options.target_file_size_multiplier: %d", target_file_size_multiplier); - Log(log," Options.max_bytes_for_level_base: %" PRIu64, + Warn(log, " Options.max_bytes_for_level_base: %" PRIu64, max_bytes_for_level_base); - Log(log, "Options.level_compaction_dynamic_level_bytes: %d", + Warn(log, "Options.level_compaction_dynamic_level_bytes: %d", level_compaction_dynamic_level_bytes); - Log(log," Options.max_bytes_for_level_multiplier: %d", + Warn(log, " Options.max_bytes_for_level_multiplier: %d", max_bytes_for_level_multiplier); for (size_t i = 0; i < max_bytes_for_level_multiplier_additional.size(); i++) { - Log(log, "Options.max_bytes_for_level_multiplier_addtl[%zu]: %d", i, + Warn(log, "Options.max_bytes_for_level_multiplier_addtl[%zu]: %d", i, max_bytes_for_level_multiplier_additional[i]); } - Log(log," Options.max_sequential_skip_in_iterations: %" PRIu64, + Warn(log, " Options.max_sequential_skip_in_iterations: %" PRIu64, max_sequential_skip_in_iterations); - Log(log," Options.expanded_compaction_factor: %d", + Warn(log, " Options.expanded_compaction_factor: %d", expanded_compaction_factor); - Log(log," Options.source_compaction_factor: %d", + Warn(log, " Options.source_compaction_factor: %d", source_compaction_factor); - Log(log," Options.max_grandparent_overlap_factor: %d", + Warn(log, " Options.max_grandparent_overlap_factor: %d", max_grandparent_overlap_factor); - Log(log," Options.arena_block_size: %zu", + Warn(log, " Options.arena_block_size: %zu", arena_block_size); - Log(log," Options.soft_rate_limit: %.2f", + Warn(log, " Options.soft_rate_limit: %.2f", soft_rate_limit); - Log(log," Options.hard_rate_limit: %.2f", + Warn(log, " Options.hard_rate_limit: %.2f", hard_rate_limit); - Log(log," Options.rate_limit_delay_max_milliseconds: %u", + Warn(log, " Options.rate_limit_delay_max_milliseconds: %u", rate_limit_delay_max_milliseconds); - Log(log," Options.disable_auto_compactions: %d", + Warn(log, " Options.disable_auto_compactions: %d", disable_auto_compactions); - Log(log," Options.purge_redundant_kvs_while_flush: %d", + Warn(log, " Options.purge_redundant_kvs_while_flush: %d", purge_redundant_kvs_while_flush); - Log(log," Options.filter_deletes: %d", + Warn(log, " Options.filter_deletes: %d", filter_deletes); - Log(log, " Options.verify_checksums_in_compaction: %d", + Warn(log, " Options.verify_checksums_in_compaction: %d", verify_checksums_in_compaction); - Log(log," Options.compaction_style: %d", + Warn(log, " Options.compaction_style: %d", compaction_style); - Log(log," Options.compaction_options_universal.size_ratio: %u", + Warn(log, " Options.compaction_options_universal.size_ratio: %u", compaction_options_universal.size_ratio); - Log(log,"Options.compaction_options_universal.min_merge_width: %u", + Warn(log, "Options.compaction_options_universal.min_merge_width: %u", compaction_options_universal.min_merge_width); - Log(log,"Options.compaction_options_universal.max_merge_width: %u", + Warn(log, "Options.compaction_options_universal.max_merge_width: %u", compaction_options_universal.max_merge_width); - Log(log,"Options.compaction_options_universal." + Warn(log, "Options.compaction_options_universal." "max_size_amplification_percent: %u", compaction_options_universal.max_size_amplification_percent); - Log(log, + Warn(log, "Options.compaction_options_universal.compression_size_percent: %d", compaction_options_universal.compression_size_percent); - Log(log, "Options.compaction_options_fifo.max_table_files_size: %" PRIu64, + Warn(log, "Options.compaction_options_fifo.max_table_files_size: %" PRIu64, compaction_options_fifo.max_table_files_size); std::string collector_names; for (const auto& collector_factory : table_properties_collector_factories) { collector_names.append(collector_factory->Name()); collector_names.append("; "); } - Log(log, " Options.table_properties_collectors: %s", + Warn(log, " Options.table_properties_collectors: %s", collector_names.c_str()); - Log(log, " Options.inplace_update_support: %d", + Warn(log, " Options.inplace_update_support: %d", inplace_update_support); - Log(log, " Options.inplace_update_num_locks: %zd", + Warn(log, " Options.inplace_update_num_locks: %zd", inplace_update_num_locks); - Log(log, " Options.min_partial_merge_operands: %u", + Warn(log, " Options.min_partial_merge_operands: %u", min_partial_merge_operands); // TODO: easier config for bloom (maybe based on avg key/value size) - Log(log, " Options.memtable_prefix_bloom_bits: %d", + Warn(log, " Options.memtable_prefix_bloom_bits: %d", memtable_prefix_bloom_bits); - Log(log, " Options.memtable_prefix_bloom_probes: %d", + Warn(log, " Options.memtable_prefix_bloom_probes: %d", memtable_prefix_bloom_probes); - Log(log, " Options.memtable_prefix_bloom_huge_page_tlb_size: %zu", + Warn(log, " Options.memtable_prefix_bloom_huge_page_tlb_size: %zu", memtable_prefix_bloom_huge_page_tlb_size); - Log(log, " Options.bloom_locality: %d", + Warn(log, " Options.bloom_locality: %d", bloom_locality); - Log(log, " Options.max_successive_merges: %zd", + Warn(log, " Options.max_successive_merges: %zd", max_successive_merges); - Log(log, " Options.optimize_fllters_for_hits: %d", + Warn(log, " Options.optimize_fllters_for_hits: %d", optimize_filters_for_hits); } // ColumnFamilyOptions::Dump