Add db_bench option for stderr logging

Summary:
The info log file ("LOG") is stored in the db directory by default. When the db is on a distributed env, this is unnecessarily slow. So, I added an option to db_bench to just print the info log messages to stderr.
Closes https://github.com/facebook/rocksdb/pull/1641

Differential Revision: D4309348

Pulled By: ajkr

fbshipit-source-id: 1e6f851
This commit is contained in:
Andrew Kryczka 2016-12-09 16:36:43 -08:00 committed by Facebook Github Bot
parent 2cabdb8f44
commit dc64f46b1c

View File

@ -60,6 +60,7 @@
#include "util/mutexlock.h" #include "util/mutexlock.h"
#include "util/random.h" #include "util/random.h"
#include "util/statistics.h" #include "util/statistics.h"
#include "util/stderr_logger.h"
#include "util/string_util.h" #include "util/string_util.h"
#include "util/testutil.h" #include "util/testutil.h"
#include "util/transaction_test_util.h" #include "util/transaction_test_util.h"
@ -592,6 +593,9 @@ DEFINE_string(
DEFINE_bool(report_bg_io_stats, false, DEFINE_bool(report_bg_io_stats, false,
"Measure times spents on I/Os while in compactions. "); "Measure times spents on I/Os while in compactions. ");
DEFINE_bool(use_stderr_info_logger, false,
"Write info logs to stderr instead of to LOG file. ");
DEFINE_bool(use_blob_db, false, "Whether to use BlobDB. "); DEFINE_bool(use_blob_db, false, "Whether to use BlobDB. ");
enum rocksdb::CompressionType StringToCompressionType(const char* ctype) { enum rocksdb::CompressionType StringToCompressionType(const char* ctype) {
@ -2745,6 +2749,9 @@ class Benchmark {
exit(1); exit(1);
} }
} }
if (FLAGS_use_stderr_info_logger) {
options.info_log.reset(new StderrLogger());
}
options.memtable_huge_page_size = FLAGS_memtable_use_huge_page ? 2048 : 0; options.memtable_huge_page_size = FLAGS_memtable_use_huge_page ? 2048 : 0;
options.memtable_prefix_bloom_size_ratio = FLAGS_memtable_bloom_size_ratio; options.memtable_prefix_bloom_size_ratio = FLAGS_memtable_bloom_size_ratio;
if (FLAGS_memtable_insert_with_hint_prefix_size > 0) { if (FLAGS_memtable_insert_with_hint_prefix_size > 0) {