Log the open-options to the LOG.

Summary: Log the open-options to the LOG. Use options_ instead of options because SanitizeOptions could modify the max_file_open limit.

Test Plan: num db_bench

Reviewers: heyongqiang

Reviewed By: heyongqiang

Differential Revision: https://reviews.facebook.net/D4833
main
Dhruba Borthakur 13 years ago
parent 21082fa13c
commit e5a7c8e580
  1. 4
      db/db_impl.cc
  2. 2
      include/leveldb/options.h
  3. 22
      util/options.cc

@ -141,12 +141,14 @@ DBImpl::DBImpl(const Options& options, const std::string& dbname)
stats_ = new CompactionStats[options.num_levels];
// Reserve ten files or so for other uses and give the rest to TableCache.
const int table_cache_size = options.max_open_files - 10;
const int table_cache_size = options_.max_open_files - 10;
table_cache_ = new TableCache(dbname_, &options_, table_cache_size);
versions_ = new VersionSet(dbname_, &options_, table_cache_,
&internal_comparator_);
options_.Dump(options_.info_log);
#ifdef USE_SCRIBE
logger_ = new ScribeLogger("localhost", 1456);
#endif

@ -206,6 +206,8 @@ struct Options {
// Create an Options object with default values for all fields.
Options();
void Dump(Logger * log) const;
};
// Options that control read operations

@ -6,6 +6,7 @@
#include "leveldb/comparator.h"
#include "leveldb/env.h"
#include "leveldb/filter_policy.h"
namespace leveldb {
@ -39,4 +40,25 @@ Options::Options()
db_stats_log_interval(1800) {
}
void
Options::Dump(
Logger * log) const
{
Log(log," Options.comparator: %s", comparator->Name());
Log(log," Options.create_if_missing: %d", create_if_missing);
Log(log," Options.error_if_exists: %d", error_if_exists);
Log(log," Options.paranoid_checks: %d", paranoid_checks);
Log(log," Options.env: %p", env);
Log(log," Options.info_log: %p", info_log);
Log(log," Options.write_buffer_size: %zd", write_buffer_size);
Log(log," Options.max_open_files: %d", max_open_files);
Log(log," Options.block_cache: %p", block_cache);
Log(log," Options.block_size: %zd", block_size);
Log(log,"Options.block_restart_interval: %d", block_restart_interval);
Log(log," Options.compression: %d", compression);
Log(log," Options.filter_policy: %s", filter_policy == NULL ? "NULL" : filter_policy->Name());
} // Options::Dump
} // namespace leveldb

Loading…
Cancel
Save