From d89ed1fdcb34b23858e22325f19f9e0fc38e60bb Mon Sep 17 00:00:00 2001 From: Han Fei Date: Tue, 9 Jul 2024 15:22:20 +0000 Subject: [PATCH] disable WAL --- src/Coordination/RocksDBContainer.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Coordination/RocksDBContainer.h b/src/Coordination/RocksDBContainer.h index a4a236f332e..46dc755aad8 100644 --- a/src/Coordination/RocksDBContainer.h +++ b/src/Coordination/RocksDBContainer.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -195,7 +196,6 @@ public: rocksdb_dir, status.ToString()); } rocksdb_ptr = std::unique_ptr(db); - /// storage_ptr = storage_; initialized = true; } @@ -312,8 +312,10 @@ public: } else if (status.IsNotFound()) { - // storage->addDigest(value, key); - status = rocksdb_ptr->Put(rocksdb::WriteOptions(), encoded_key, value.getEncodedString()); + rocksdb::WriteOptions write_options; + write_options.disableWAL = true; + + status = rocksdb_ptr->Put(write_options, encoded_key, value.getEncodedString()); if (status.ok()) { counter++; @@ -336,7 +338,10 @@ public: else if (!status.ok()) throw Exception(ErrorCodes::ROCKSDB_ERROR, "Got rocksdb error during get. The error message is {}.", status.ToString()); - status = rocksdb_ptr->Put(rocksdb::WriteOptions(), encoded_key, value.getEncodedString()); + rocksdb::WriteOptions write_options; + write_options.disableWAL = true; + + status = rocksdb_ptr->Put(write_options, encoded_key, value.getEncodedString()); if (status.ok()) counter += increase_counter; else @@ -361,7 +366,11 @@ public: { /// storage->removeDigest(value, key); const std::string & encoded_key = getEncodedKey(key); - auto status = rocksdb_ptr->Delete(rocksdb::WriteOptions(), encoded_key); + + rocksdb::WriteOptions write_options; + write_options.disableWAL = true; + + auto status = rocksdb_ptr->Delete(write_options, encoded_key); if (status.IsNotFound()) return false; if (status.ok()) @@ -445,8 +454,6 @@ private: std::unique_ptr rocksdb_ptr; - /// Storage* storage_ptr; - const rocksdb::Snapshot * snapshot; bool snapshot_mode{false};