disable gc during test

This commit is contained in:
abbycin 2025-08-24 21:44:02 +08:00
parent 7c672c32fe
commit 2ead4023ff
Signed by: abby
GPG Key ID: B636E0F0307EF8EB
3 changed files with 18 additions and 4 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@
*.png *.png
*.csv *.csv
pyvenv.cfg pyvenv.cfg
Cargo.lock

View File

@ -80,8 +80,14 @@ int main(int argc, char *argv[]) {
options.create_if_missing = true; options.create_if_missing = true;
options.allow_concurrent_memtable_write = true; options.allow_concurrent_memtable_write = true;
options.enable_pipelined_write = true; options.enable_pipelined_write = true;
// the following three options makes it not trigger GC in test
options.level0_file_num_compaction_trigger = 1000;
options.write_buffer_size = 1 << 30;
options.max_write_buffer_number = 5;
auto ropt = rocksdb::ReadOptions(); auto ropt = rocksdb::ReadOptions();
auto wopt = rocksdb::WriteOptions(); auto wopt = rocksdb::WriteOptions();
// wopt.disableWAL = true;
std::vector<std::thread> wg; std::vector<std::thread> wg;
std::vector<std::vector<std::string>> keys{}; std::vector<std::vector<std::string>> keys{};
std::atomic<uint64_t> total_op{0}; std::atomic<uint64_t> total_op{0};
@ -175,7 +181,8 @@ int main(int argc, char *argv[]) {
return args.mode == "insert" ? 100 : 0; return args.mode == "insert" ? 100 : 0;
}(); }();
double ops = static_cast<double>(total_op.load(std::memory_order_relaxed)) / b.elapse_sec(); double ops = static_cast<double>(total_op.load(std::memory_order_relaxed)) / b.elapse_sec();
std::println("{},{},{},{},{},{:.2f}", args.mode, args.threads, args.key_size, args.value_size, ratio, ops); std::println("{},{},{},{},{},{:.2f},{}", args.mode, args.threads, args.key_size, args.value_size, ratio, ops,
b.elapse_ms());
delete db; delete db;
std::filesystem::remove_all(args.path); std::filesystem::remove_all(args.path);
} }

View File

@ -66,7 +66,7 @@ fn main() {
let mut opt = Options::new(path); let mut opt = Options::new(path);
opt.sync_on_write = false; opt.sync_on_write = false;
opt.tmp_store = true; opt.tmp_store = true;
opt.consolidate_threshold = 512; opt.gc_timeout = 1000 * 60; // make sure GC will not work
// opt.cache_capacity = 3 << 30; // this is very important for large key-value store // opt.cache_capacity = 3 << 30; // this is very important for large key-value store
let db = Mace::new(opt.validate().unwrap()).unwrap(); let db = Mace::new(opt.validate().unwrap()).unwrap();
@ -184,7 +184,13 @@ fn main() {
}; };
// eprintln!("mode,threads,key_size,value_size,insert_ratio,ops"); // eprintln!("mode,threads,key_size,value_size,insert_ratio,ops");
eprintln!( eprintln!(
"{},{},{},{},{},{:.2}", "{},{},{},{},{},{:.2},{}",
args.mode, args.threads, args.key_size, args.value_size, ratio, ops args.mode,
args.threads,
args.key_size,
args.value_size,
ratio,
ops,
duration.as_millis()
); );
} }