|
|
@ -120,9 +120,26 @@ static class leveldb::DBStatistics* dbstats = NULL; |
|
|
|
// Number of write operations to do. If negative, do FLAGS_num reads.
|
|
|
|
// Number of write operations to do. If negative, do FLAGS_num reads.
|
|
|
|
static long FLAGS_writes = -1; |
|
|
|
static long FLAGS_writes = -1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// These default values might change if the hardcoded
|
|
|
|
|
|
|
|
|
|
|
|
// Sync all writes to disk
|
|
|
|
// Sync all writes to disk
|
|
|
|
static bool FLAGS_sync = false; |
|
|
|
static bool FLAGS_sync = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If true, do not wait until data is synced to disk.
|
|
|
|
|
|
|
|
static bool FLAGS_disable_data_sync = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Target level-0 file size for compaction
|
|
|
|
|
|
|
|
static int FLAGS_target_file_size_base = 2 * 1048576; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// A multiplier to compute targe level-N file size
|
|
|
|
|
|
|
|
static int FLAGS_target_file_size_multiplier = 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Max bytes for level-0
|
|
|
|
|
|
|
|
static int FLAGS_max_bytes_for_level_base = 10 * 1048576; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// A multiplier to compute max bytes for level-N
|
|
|
|
|
|
|
|
static int FLAGS_max_bytes_for_level_multiplier = 10; |
|
|
|
|
|
|
|
|
|
|
|
// posix or hdfs environment
|
|
|
|
// posix or hdfs environment
|
|
|
|
static leveldb::Env* FLAGS_env = leveldb::Env::Default(); |
|
|
|
static leveldb::Env* FLAGS_env = leveldb::Env::Default(); |
|
|
|
|
|
|
|
|
|
|
@ -745,6 +762,12 @@ class Benchmark { |
|
|
|
options.max_open_files = FLAGS_open_files; |
|
|
|
options.max_open_files = FLAGS_open_files; |
|
|
|
options.statistics = dbstats; |
|
|
|
options.statistics = dbstats; |
|
|
|
options.env = FLAGS_env; |
|
|
|
options.env = FLAGS_env; |
|
|
|
|
|
|
|
options.disableDataSync = FLAGS_disable_data_sync; |
|
|
|
|
|
|
|
options.target_file_size_base = FLAGS_target_file_size_base; |
|
|
|
|
|
|
|
options.target_file_size_multiplier = FLAGS_target_file_size_multiplier; |
|
|
|
|
|
|
|
options.max_bytes_for_level_base = FLAGS_max_bytes_for_level_base; |
|
|
|
|
|
|
|
options.max_bytes_for_level_multiplier = |
|
|
|
|
|
|
|
FLAGS_max_bytes_for_level_multiplier; |
|
|
|
Status s = DB::Open(options, FLAGS_db, &db_); |
|
|
|
Status s = DB::Open(options, FLAGS_db, &db_); |
|
|
|
if (!s.ok()) { |
|
|
|
if (!s.ok()) { |
|
|
|
fprintf(stderr, "open error: %s\n", s.ToString().c_str()); |
|
|
|
fprintf(stderr, "open error: %s\n", s.ToString().c_str()); |
|
|
@ -1030,8 +1053,23 @@ int main(int argc, char** argv) { |
|
|
|
} else if (sscanf(argv[i], "--sync=%d%c", &n, &junk) == 1 && |
|
|
|
} else if (sscanf(argv[i], "--sync=%d%c", &n, &junk) == 1 && |
|
|
|
(n == 0 || n == 1)) { |
|
|
|
(n == 0 || n == 1)) { |
|
|
|
FLAGS_sync = n; |
|
|
|
FLAGS_sync = n; |
|
|
|
|
|
|
|
} else if (sscanf(argv[i], "--disable_data_sync=%d%c", &n, &junk) == 1 && |
|
|
|
|
|
|
|
(n == 0 || n == 1)) { |
|
|
|
|
|
|
|
FLAGS_disable_data_sync = n; |
|
|
|
} else if (sscanf(argv[i], "--hdfs=%s", &hdfsname) == 1) { |
|
|
|
} else if (sscanf(argv[i], "--hdfs=%s", &hdfsname) == 1) { |
|
|
|
FLAGS_env = new leveldb::HdfsEnv(hdfsname); |
|
|
|
FLAGS_env = new leveldb::HdfsEnv(hdfsname); |
|
|
|
|
|
|
|
} else if (sscanf(argv[i], "--target_file_size_base=%d%c", |
|
|
|
|
|
|
|
&n, &junk) == 1) { |
|
|
|
|
|
|
|
FLAGS_target_file_size_base = n; |
|
|
|
|
|
|
|
} else if ( sscanf(argv[i], "--target_file_size_multiplier=%d%c", |
|
|
|
|
|
|
|
&n, &junk) == 1) { |
|
|
|
|
|
|
|
FLAGS_target_file_size_multiplier = n; |
|
|
|
|
|
|
|
} else if ( |
|
|
|
|
|
|
|
sscanf(argv[i], "--max_bytes_for_level_base=%d%c", &n, &junk) == 1) { |
|
|
|
|
|
|
|
FLAGS_max_bytes_for_level_base = n; |
|
|
|
|
|
|
|
} else if (sscanf(argv[i], "--max_bytes_for_level_multiplier=%d%c", |
|
|
|
|
|
|
|
&n, &junk) == 1) { |
|
|
|
|
|
|
|
FLAGS_max_bytes_for_level_multiplier = n; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
fprintf(stderr, "Invalid flag '%s'\n", argv[i]); |
|
|
|
fprintf(stderr, "Invalid flag '%s'\n", argv[i]); |
|
|
|
exit(1); |
|
|
|
exit(1); |
|
|
|