Skip to content

Commit 09c706d

Browse files
Merge pull request #7 from utsaslab/block-size-param
Adding block_size as a configurable parameter to db_bench
2 parents 3a49639 + 71c6fd4 commit 09c706d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

db/db_bench.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ static int FLAGS_cache_size = -1;
122122
// Maximum number of files to keep open at the same time (use default if == 0)
123123
static int FLAGS_open_files = 0;
124124

125+
// Amount of data per block (initialized to default value by "main")
126+
static int FLAGS_block_size = 0;
127+
125128
// Number of next operations to do in a ScanRandom workload
126129
static int FLAGS_num_next = 1;
127130

@@ -1191,6 +1194,7 @@ class Benchmark {
11911194
options.block_cache = cache_;
11921195
options.write_buffer_size = FLAGS_write_buffer_size;
11931196
options.max_open_files = FLAGS_open_files;
1197+
options.block_size = FLAGS_block_size;
11941198
options.filter_policy = filter_policy_;
11951199
Status s = DB::Open(options, FLAGS_db, &db_);
11961200
if (!s.ok()) {
@@ -1582,7 +1586,7 @@ class Benchmark {
15821586
int main(int argc, char** argv) {
15831587
FLAGS_write_buffer_size = leveldb::Options().write_buffer_size;
15841588
FLAGS_open_files = leveldb::Options().max_open_files;
1585-
FLAGS_open_files = 1000;
1589+
FLAGS_block_size = leveldb::Options().block_size;
15861590
std::string default_db_path;
15871591

15881592
for (int i = 1; i < argc; i++) {
@@ -1615,6 +1619,8 @@ int main(int argc, char** argv) {
16151619
FLAGS_write_buffer_size = n;
16161620
} else if (sscanf(argv[i], "--cache_size=%d%c", &n, &junk) == 1) {
16171621
FLAGS_cache_size = n;
1622+
} else if (sscanf(argv[i], "--block_size=%d%c", &n, &junk) == 1) {
1623+
FLAGS_block_size = n;
16181624
} else if (sscanf(argv[i], "--bloom_bits=%d%c", &n, &junk) == 1) {
16191625
FLAGS_bloom_bits = n;
16201626
} else if (sscanf(argv[i], "--open_files=%d%c", &n, &junk) == 1) {

0 commit comments

Comments
 (0)