Commit 129f6c7d authored by Huachao Huang's avatar Huachao Huang Committed by GitHub

Fix `read_amp_bytes_per_bit` test (#140)

parent 1742f182
...@@ -573,12 +573,15 @@ fn test_block_based_options() { ...@@ -573,12 +573,15 @@ fn test_block_based_options() {
opts.enable_statistics(); opts.enable_statistics();
opts.set_stats_dump_period_sec(60); opts.set_stats_dump_period_sec(60);
let mut bopts = BlockBasedOptions::new(); let mut bopts = BlockBasedOptions::new();
bopts.set_read_amp_bytes_per_bit(16); bopts.set_read_amp_bytes_per_bit(4);
let mut cfopts = ColumnFamilyOptions::new(); let mut cfopts = ColumnFamilyOptions::new();
cfopts.set_block_based_table_factory(&bopts); cfopts.set_block_based_table_factory(&bopts);
let db = DB::open_cf(opts.clone(), path_str, vec!["default"], vec![cfopts]).unwrap(); let db = DB::open_cf(opts.clone(), path_str, vec!["default"], vec![cfopts]).unwrap();
db.put(b"a", b"a").unwrap(); // RocksDB use randomness for the read amplification statistics,
// we should use a bigger enough value (> `bytes_per_bit`) to make
// sure the statistics will not be 0.
db.put(b"a", b"abcdef").unwrap();
db.flush(true).unwrap(); db.flush(true).unwrap();
db.get(b"a").unwrap(); db.get(b"a").unwrap();
assert_ne!( assert_ne!(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment