This commit is contained in:
abbycin 2025-11-16 10:42:09 +08:00
parent a90a0377e7
commit cede3452b4
Signed by: abby
GPG Key ID: B636E0F0307EF8EB

View File

@ -6,6 +6,7 @@
#include <random> #include <random>
#include <rocksdb/cache.h> #include <rocksdb/cache.h>
#include <rocksdb/db.h> #include <rocksdb/db.h>
#include <rocksdb/env.h>
#include <rocksdb/options.h> #include <rocksdb/options.h>
#include <rocksdb/table.h> #include <rocksdb/table.h>
#include <rocksdb/utilities/optimistic_transaction_db.h> #include <rocksdb/utilities/optimistic_transaction_db.h>
@ -88,9 +89,9 @@ int main(int argc, char *argv[]) {
table_options.block_cache = cache; table_options.block_cache = cache;
cfo.table_factory.reset(NewBlockBasedTableFactory(table_options)); cfo.table_factory.reset(NewBlockBasedTableFactory(table_options));
// the following three options makes it not trigger GC in test // the following three options makes it not trigger GC in test
cfo.level0_file_num_compaction_trigger = 1000; cfo.level0_file_num_compaction_trigger = 10000;
cfo.write_buffer_size = 1 << 30; cfo.write_buffer_size = 64 << 20;
cfo.max_write_buffer_number = 5; cfo.max_write_buffer_number = 16;
std::vector<rocksdb::ColumnFamilyDescriptor> cfd{}; std::vector<rocksdb::ColumnFamilyDescriptor> cfd{};
cfd.push_back(rocksdb::ColumnFamilyDescriptor("default", cfo)); cfd.push_back(rocksdb::ColumnFamilyDescriptor("default", cfo));
@ -99,6 +100,7 @@ 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;
options.env->SetBackgroundThreads(4, rocksdb::Env::Priority::HIGH);
auto ropt = rocksdb::ReadOptions(); auto ropt = rocksdb::ReadOptions();
auto wopt = rocksdb::WriteOptions(); auto wopt = rocksdb::WriteOptions();