From b5ee80292086f95423a75941bd47c8a4f1960439 Mon Sep 17 00:00:00 2001 From: super-Pan66 <1719739132@qq.com> Date: Wed, 21 Feb 2024 20:09:22 +0800 Subject: [PATCH 01/12] handle conflicts --- src/cmd_hash.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cmd_hash.cc b/src/cmd_hash.cc index 60f2e3b01..f4889e6a0 100644 --- a/src/cmd_hash.cc +++ b/src/cmd_hash.cc @@ -257,8 +257,6 @@ bool HScanCmd::DoInitial(PClient* client) { client->SetRes(CmdRes::kSyntaxErr, kCmdNameHScan); return false; } - client->SetKey(client->argv_[1]); - return true; } void HScanCmd::DoCmd(PClient* client) { @@ -328,7 +326,7 @@ void HValsCmd::DoCmd(PClient* client) { } } -HIncrbyFloatCmd::HIncrbyFloatCmd(const std::string& name, int16_t arity) +HIncrbyFloatCmd::HIncrbyFloatCmd(const std::string &name, int16_t arity) : BaseCmd(name, arity, kCmdFlagsWrite, kAclCategoryWrite | kAclCategoryHash) {} bool HIncrbyFloatCmd::DoInitial(PClient* client) { @@ -343,7 +341,7 @@ bool HIncrbyFloatCmd::DoInitial(PClient* client) { void HIncrbyFloatCmd::DoCmd(PClient* client) { long double long_double_by = 0; - if (-1 == StrToLongDouble(client->argv_[3].c_str(), static_cast(client->argv_[3].size()), &long_double_by)) { + if(-1 == StrToLongDouble(client->argv_[3].c_str(), static_cast(client->argv_[3].size()), &long_double_by)){ client->SetRes(CmdRes::kInvalidFloat); return; } From ef8fcba6918cd12903be08666a85a187722781da Mon Sep 17 00:00:00 2001 From: super-Pan66 <1719739132@qq.com> Date: Fri, 12 Jan 2024 16:14:49 +0800 Subject: [PATCH 02/12] resolve conflict & use blackwindow interface --- src/cmd_hash.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd_hash.cc b/src/cmd_hash.cc index f4889e6a0..5a3257036 100644 --- a/src/cmd_hash.cc +++ b/src/cmd_hash.cc @@ -341,7 +341,7 @@ bool HIncrbyFloatCmd::DoInitial(PClient* client) { void HIncrbyFloatCmd::DoCmd(PClient* client) { long double long_double_by = 0; - if(-1 == StrToLongDouble(client->argv_[3].c_str(), static_cast(client->argv_[3].size()), &long_double_by)){ + if (-1 == StrToLongDouble(client->argv_[3].c_str(), static_cast(client->argv_[3].size()), &long_double_by)) { client->SetRes(CmdRes::kInvalidFloat); return; } From 317cfd05890dd963e9365854579231733e4aef1b Mon Sep 17 00:00:00 2001 From: super-Pan66 <1719739132@qq.com> Date: Fri, 12 Jan 2024 16:17:27 +0800 Subject: [PATCH 03/12] code format --- src/cmd_hash.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd_hash.cc b/src/cmd_hash.cc index 5a3257036..c72172a11 100644 --- a/src/cmd_hash.cc +++ b/src/cmd_hash.cc @@ -326,7 +326,7 @@ void HValsCmd::DoCmd(PClient* client) { } } -HIncrbyFloatCmd::HIncrbyFloatCmd(const std::string &name, int16_t arity) +HIncrbyFloatCmd::HIncrbyFloatCmd(const std::string& name, int16_t arity) : BaseCmd(name, arity, kCmdFlagsWrite, kAclCategoryWrite | kAclCategoryHash) {} bool HIncrbyFloatCmd::DoInitial(PClient* client) { From 97a562e648c59118c8daf9efa5b4fb6c135e2651 Mon Sep 17 00:00:00 2001 From: super-Pan66 <1719739132@qq.com> Date: Fri, 12 Jan 2024 16:37:24 +0800 Subject: [PATCH 04/12] fix: revert a mistakenly deleted code --- src/cmd_hash.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cmd_hash.cc b/src/cmd_hash.cc index c72172a11..60f2e3b01 100644 --- a/src/cmd_hash.cc +++ b/src/cmd_hash.cc @@ -257,6 +257,8 @@ bool HScanCmd::DoInitial(PClient* client) { client->SetRes(CmdRes::kSyntaxErr, kCmdNameHScan); return false; } + client->SetKey(client->argv_[1]); + return true; } void HScanCmd::DoCmd(PClient* client) { From 082d9be3db01f82520f4cd29cb5c4e044a87ac8c Mon Sep 17 00:00:00 2001 From: super-Pan66 <1719739132@qq.com> Date: Wed, 13 Mar 2024 21:48:47 +0800 Subject: [PATCH 05/12] feat: reimplement cmd flushdb & flushall --- src/cmd_admin.cc | 59 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/src/cmd_admin.cc b/src/cmd_admin.cc index b363201b4..27faf9951 100644 --- a/src/cmd_admin.cc +++ b/src/cmd_admin.cc @@ -8,6 +8,7 @@ #include "cmd_admin.h" #include "pikiwidb.h" #include "store.h" +#include "pstd/env.h" namespace pikiwidb { @@ -48,10 +49,25 @@ FlushdbCmd::FlushdbCmd(const std::string& name, int16_t arity) bool FlushdbCmd::DoInitial(PClient* client) { return true; } void FlushdbCmd::DoCmd(PClient* client) { - // PSTORE.dirty_ += PSTORE.DBSize(); - // PSTORE.ClearCurrentDB(); - // Propagate(PSTORE.GetDB(), std::vector{"flushdb"}); - client->AppendString("flushdb cmd in development"); + int currentDBIndex = client->GetCurrentDB(); + PSTORE.GetBackend(currentDBIndex).reset(); + + std::string db_path_ = g_config.dbpath + std::to_string(currentDBIndex); + std::string path_temp_ = db_path_; + path_temp_.append("_deleting/"); + pstd::RenameFile(db_path_, path_temp_); + + PSTORE.GetBackend(currentDBIndex) = std::make_unique(); + storage::StorageOptions storage_options; + storage_options.options.create_if_missing = true; + storage_options.db_instance_num = g_config.db_instance_num; + storage_options.options.ttl = g_config.rocksdb_ttl_second; + storage_options.options.periodic_compaction_seconds = g_config.rocksdb_periodic_second; + + storage::Status s = PSTORE.GetBackend(currentDBIndex)->Open(storage_options, db_path_.data()); + assert(s.ok()); + pstd::DeleteDir(path_temp_); + client->SetRes(CmdRes::kOK); } FlushallCmd::FlushallCmd(const std::string& name, int16_t arity) @@ -60,21 +76,26 @@ FlushallCmd::FlushallCmd(const std::string& name, int16_t arity) bool FlushallCmd::DoInitial(PClient* client) { return true; } void FlushallCmd::DoCmd(PClient* client) { - // int currentDB = PSTORE.GetDB(); - // std::vector param{"flushall"}; - // DEFER { - // PSTORE.SelectDB(currentDB); - // Propagate(-1, param); - // PSTORE.ResetDB(); - // }; - // - // for (int dbno = 0; true; ++dbno) { - // if (PSTORE.SelectDB(dbno) == -1) { - // break; - // } - // PSTORE.dirty_ += PSTORE.DBSize(); - // } - client->AppendString("flushall' cmd in development"); + for (size_t i = 0; i < g_config.databases; ++i) { + PSTORE.GetBackend(i).reset(); + + std::string db_path_ = g_config.dbpath + std::to_string(i); + std::string path_temp_ = db_path_; + path_temp_.append("_deleting/"); + pstd::RenameFile(db_path_, path_temp_); + + PSTORE.GetBackend(i) = std::make_unique(); + storage::StorageOptions storage_options; + storage_options.options.create_if_missing = true; + storage_options.db_instance_num = g_config.db_instance_num; + storage_options.options.ttl = g_config.rocksdb_ttl_second; + storage_options.options.periodic_compaction_seconds = g_config.rocksdb_periodic_second; + + storage::Status s = PSTORE.GetBackend(i)->Open(storage_options, db_path_.data()); + assert(s.ok()); + pstd::DeleteDir(path_temp_); + } + client->SetRes(CmdRes::kOK); } SelectCmd::SelectCmd(const std::string& name, int16_t arity) From 53f01ffc2a6d5666474c498c89533b34b52dd589 Mon Sep 17 00:00:00 2001 From: super-Pan66 <1719739132@qq.com> Date: Sun, 28 Apr 2024 22:57:23 +0800 Subject: [PATCH 06/12] resolve conflicts --- src/cmd_admin.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cmd_admin.cc b/src/cmd_admin.cc index 27faf9951..7d200ac5e 100644 --- a/src/cmd_admin.cc +++ b/src/cmd_admin.cc @@ -6,9 +6,8 @@ */ #include "cmd_admin.h" -#include "pikiwidb.h" -#include "store.h" #include "pstd/env.h" +#include "store.h" namespace pikiwidb { @@ -49,7 +48,7 @@ FlushdbCmd::FlushdbCmd(const std::string& name, int16_t arity) bool FlushdbCmd::DoInitial(PClient* client) { return true; } void FlushdbCmd::DoCmd(PClient* client) { - int currentDBIndex = client->GetCurrentDB(); + int currentDBIndex = client->GetCurrentDB(); PSTORE.GetBackend(currentDBIndex).reset(); std::string db_path_ = g_config.dbpath + std::to_string(currentDBIndex); From e5eee15c1c4bbe9d3ccaebbde6643f22fc804a10 Mon Sep 17 00:00:00 2001 From: super-Pan66 <1719739132@qq.com> Date: Thu, 21 Mar 2024 14:10:43 +0800 Subject: [PATCH 07/12] style: rename variable --- src/cmd_admin.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/cmd_admin.cc b/src/cmd_admin.cc index 7d200ac5e..35ec0079d 100644 --- a/src/cmd_admin.cc +++ b/src/cmd_admin.cc @@ -51,10 +51,10 @@ void FlushdbCmd::DoCmd(PClient* client) { int currentDBIndex = client->GetCurrentDB(); PSTORE.GetBackend(currentDBIndex).reset(); - std::string db_path_ = g_config.dbpath + std::to_string(currentDBIndex); - std::string path_temp_ = db_path_; - path_temp_.append("_deleting/"); - pstd::RenameFile(db_path_, path_temp_); + std::string db_path = g_config.dbpath + std::to_string(currentDBIndex); + std::string path_temp = db_path; + path_temp.append("_deleting/"); + pstd::RenameFile(db_path, path_temp); PSTORE.GetBackend(currentDBIndex) = std::make_unique(); storage::StorageOptions storage_options; @@ -63,9 +63,9 @@ void FlushdbCmd::DoCmd(PClient* client) { storage_options.options.ttl = g_config.rocksdb_ttl_second; storage_options.options.periodic_compaction_seconds = g_config.rocksdb_periodic_second; - storage::Status s = PSTORE.GetBackend(currentDBIndex)->Open(storage_options, db_path_.data()); + storage::Status s = PSTORE.GetBackend(currentDBIndex)->Open(storage_options, db_path.data()); assert(s.ok()); - pstd::DeleteDir(path_temp_); + pstd::DeleteDir(path_temp); client->SetRes(CmdRes::kOK); } @@ -78,10 +78,10 @@ void FlushallCmd::DoCmd(PClient* client) { for (size_t i = 0; i < g_config.databases; ++i) { PSTORE.GetBackend(i).reset(); - std::string db_path_ = g_config.dbpath + std::to_string(i); - std::string path_temp_ = db_path_; - path_temp_.append("_deleting/"); - pstd::RenameFile(db_path_, path_temp_); + std::string db_path = g_config.dbpath + std::to_string(i); + std::string path_temp = db_path; + path_temp.append("_deleting/"); + pstd::RenameFile(db_path, path_temp); PSTORE.GetBackend(i) = std::make_unique(); storage::StorageOptions storage_options; @@ -90,9 +90,9 @@ void FlushallCmd::DoCmd(PClient* client) { storage_options.options.ttl = g_config.rocksdb_ttl_second; storage_options.options.periodic_compaction_seconds = g_config.rocksdb_periodic_second; - storage::Status s = PSTORE.GetBackend(i)->Open(storage_options, db_path_.data()); + storage::Status s = PSTORE.GetBackend(i)->Open(storage_options, db_path.data()); assert(s.ok()); - pstd::DeleteDir(path_temp_); + pstd::DeleteDir(path_temp); } client->SetRes(CmdRes::kOK); } From 3a1adcb8fff8e133e7d1f93ec4d7c64f8701e29b Mon Sep 17 00:00:00 2001 From: super-Pan66 <1719739132@qq.com> Date: Sat, 23 Mar 2024 18:24:48 +0800 Subject: [PATCH 08/12] fix: use write lock interface --- src/cmd_admin.cc | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/cmd_admin.cc b/src/cmd_admin.cc index 35ec0079d..6e2061841 100644 --- a/src/cmd_admin.cc +++ b/src/cmd_admin.cc @@ -8,6 +8,7 @@ #include "cmd_admin.h" #include "pstd/env.h" #include "store.h" +#include "db.h" namespace pikiwidb { @@ -43,56 +44,60 @@ void CmdConfigSet::DoCmd(PClient* client) { } FlushdbCmd::FlushdbCmd(const std::string& name, int16_t arity) - : BaseCmd(name, arity, kCmdFlagsAdmin | kCmdFlagsWrite, kAclCategoryWrite | kAclCategoryAdmin) {} + : BaseCmd(name, arity, kCmdFlagsExclusive | kCmdFlagsAdmin | kCmdFlagsWrite, kAclCategoryWrite | kAclCategoryAdmin) {} bool FlushdbCmd::DoInitial(PClient* client) { return true; } void FlushdbCmd::DoCmd(PClient* client) { int currentDBIndex = client->GetCurrentDB(); - PSTORE.GetBackend(currentDBIndex).reset(); + PSTORE.GetBackend(currentDBIndex).get()->Lock(); + PSTORE.GetBackend(currentDBIndex)->GetStorage().reset(); std::string db_path = g_config.dbpath + std::to_string(currentDBIndex); std::string path_temp = db_path; path_temp.append("_deleting/"); pstd::RenameFile(db_path, path_temp); - PSTORE.GetBackend(currentDBIndex) = std::make_unique(); + PSTORE.GetBackend(currentDBIndex)->GetStorage() = std::make_unique(); storage::StorageOptions storage_options; storage_options.options.create_if_missing = true; storage_options.db_instance_num = g_config.db_instance_num; storage_options.options.ttl = g_config.rocksdb_ttl_second; storage_options.options.periodic_compaction_seconds = g_config.rocksdb_periodic_second; - storage::Status s = PSTORE.GetBackend(currentDBIndex)->Open(storage_options, db_path.data()); + storage::Status s = PSTORE.GetBackend(currentDBIndex)->GetStorage()->Open(storage_options, db_path.data()); assert(s.ok()); pstd::DeleteDir(path_temp); + PSTORE.GetBackend(currentDBIndex).get()->UnLock(); client->SetRes(CmdRes::kOK); } FlushallCmd::FlushallCmd(const std::string& name, int16_t arity) - : BaseCmd(name, arity, kCmdFlagsAdmin | kCmdFlagsWrite, kAclCategoryWrite | kAclCategoryAdmin) {} + : BaseCmd(name, arity, kCmdFlagsExclusive | kCmdFlagsAdmin | kCmdFlagsWrite, kAclCategoryWrite | kAclCategoryAdmin) {} bool FlushallCmd::DoInitial(PClient* client) { return true; } void FlushallCmd::DoCmd(PClient* client) { for (size_t i = 0; i < g_config.databases; ++i) { - PSTORE.GetBackend(i).reset(); + PSTORE.GetBackend(i).get()->Lock(); + PSTORE.GetBackend(i)->GetStorage().reset(); std::string db_path = g_config.dbpath + std::to_string(i); std::string path_temp = db_path; path_temp.append("_deleting/"); pstd::RenameFile(db_path, path_temp); - PSTORE.GetBackend(i) = std::make_unique(); + PSTORE.GetBackend(i)->GetStorage() = std::make_unique(); storage::StorageOptions storage_options; storage_options.options.create_if_missing = true; storage_options.db_instance_num = g_config.db_instance_num; storage_options.options.ttl = g_config.rocksdb_ttl_second; storage_options.options.periodic_compaction_seconds = g_config.rocksdb_periodic_second; - storage::Status s = PSTORE.GetBackend(i)->Open(storage_options, db_path.data()); + storage::Status s = PSTORE.GetBackend(i)->GetStorage()->Open(storage_options, db_path.data()); assert(s.ok()); pstd::DeleteDir(path_temp); + PSTORE.GetBackend(i).get()->UnLock(); } client->SetRes(CmdRes::kOK); } From 22b56e743bd3b05e721916c9c683ca92dac532fc Mon Sep 17 00:00:00 2001 From: super-Pan66 <1719739132@qq.com> Date: Sat, 23 Mar 2024 18:29:52 +0800 Subject: [PATCH 09/12] style: code format --- src/cmd_admin.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cmd_admin.cc b/src/cmd_admin.cc index 6e2061841..5c7d697bb 100644 --- a/src/cmd_admin.cc +++ b/src/cmd_admin.cc @@ -6,9 +6,9 @@ */ #include "cmd_admin.h" +#include "db.h" #include "pstd/env.h" #include "store.h" -#include "db.h" namespace pikiwidb { @@ -44,7 +44,8 @@ void CmdConfigSet::DoCmd(PClient* client) { } FlushdbCmd::FlushdbCmd(const std::string& name, int16_t arity) - : BaseCmd(name, arity, kCmdFlagsExclusive | kCmdFlagsAdmin | kCmdFlagsWrite, kAclCategoryWrite | kAclCategoryAdmin) {} + : BaseCmd(name, arity, kCmdFlagsExclusive | kCmdFlagsAdmin | kCmdFlagsWrite, + kAclCategoryWrite | kAclCategoryAdmin) {} bool FlushdbCmd::DoInitial(PClient* client) { return true; } @@ -73,7 +74,8 @@ void FlushdbCmd::DoCmd(PClient* client) { } FlushallCmd::FlushallCmd(const std::string& name, int16_t arity) - : BaseCmd(name, arity, kCmdFlagsExclusive | kCmdFlagsAdmin | kCmdFlagsWrite, kAclCategoryWrite | kAclCategoryAdmin) {} + : BaseCmd(name, arity, kCmdFlagsExclusive | kCmdFlagsAdmin | kCmdFlagsWrite, + kAclCategoryWrite | kAclCategoryAdmin) {} bool FlushallCmd::DoInitial(PClient* client) { return true; } From 5b531a3ba3e45d5400f0fc034accaf0d62db1c75 Mon Sep 17 00:00:00 2001 From: super-Pan66 <1719739132@qq.com> Date: Mon, 29 Apr 2024 20:09:30 +0800 Subject: [PATCH 10/12] resolve conflicts --- src/cmd_admin.cc | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/cmd_admin.cc b/src/cmd_admin.cc index 5c7d697bb..af5ee59d8 100644 --- a/src/cmd_admin.cc +++ b/src/cmd_admin.cc @@ -6,6 +6,7 @@ */ #include "cmd_admin.h" +#include "pikiwidb.h" #include "db.h" #include "pstd/env.h" #include "store.h" @@ -54,17 +55,24 @@ void FlushdbCmd::DoCmd(PClient* client) { PSTORE.GetBackend(currentDBIndex).get()->Lock(); PSTORE.GetBackend(currentDBIndex)->GetStorage().reset(); - std::string db_path = g_config.dbpath + std::to_string(currentDBIndex); + std::string db_path = g_config.db_path.ToString() + std::to_string(currentDBIndex); std::string path_temp = db_path; path_temp.append("_deleting/"); pstd::RenameFile(db_path, path_temp); PSTORE.GetBackend(currentDBIndex)->GetStorage() = std::make_unique(); storage::StorageOptions storage_options; - storage_options.options.create_if_missing = true; + storage_options.options = g_config.GetRocksDBOptions(); + auto cap = storage_options.db_instance_num * kColumnNum * storage_options.options.write_buffer_size * + storage_options.options.max_write_buffer_number; + storage_options.options.write_buffer_manager = std::make_shared(cap); + + storage_options.table_options = g_config.GetRocksDBBlockBasedTableOptions(); + + storage_options.small_compaction_threshold = g_config.small_compaction_threshold.load(); + storage_options.small_compaction_duration_threshold = g_config.small_compaction_duration_threshold.load(); storage_options.db_instance_num = g_config.db_instance_num; - storage_options.options.ttl = g_config.rocksdb_ttl_second; - storage_options.options.periodic_compaction_seconds = g_config.rocksdb_periodic_second; + storage_options.db_id = currentDBIndex; storage::Status s = PSTORE.GetBackend(currentDBIndex)->GetStorage()->Open(storage_options, db_path.data()); assert(s.ok()); @@ -84,17 +92,24 @@ void FlushallCmd::DoCmd(PClient* client) { PSTORE.GetBackend(i).get()->Lock(); PSTORE.GetBackend(i)->GetStorage().reset(); - std::string db_path = g_config.dbpath + std::to_string(i); + std::string db_path = g_config.db_path.ToString() + std::to_string(i); std::string path_temp = db_path; path_temp.append("_deleting/"); pstd::RenameFile(db_path, path_temp); PSTORE.GetBackend(i)->GetStorage() = std::make_unique(); storage::StorageOptions storage_options; - storage_options.options.create_if_missing = true; + storage_options.options = g_config.GetRocksDBOptions(); + auto cap = storage_options.db_instance_num * kColumnNum * storage_options.options.write_buffer_size * + storage_options.options.max_write_buffer_number; + storage_options.options.write_buffer_manager = std::make_shared(cap); + + storage_options.table_options = g_config.GetRocksDBBlockBasedTableOptions(); + + storage_options.small_compaction_threshold = g_config.small_compaction_threshold.load(); + storage_options.small_compaction_duration_threshold = g_config.small_compaction_duration_threshold.load(); storage_options.db_instance_num = g_config.db_instance_num; - storage_options.options.ttl = g_config.rocksdb_ttl_second; - storage_options.options.periodic_compaction_seconds = g_config.rocksdb_periodic_second; + storage_options.db_id = static_cast(i); storage::Status s = PSTORE.GetBackend(i)->GetStorage()->Open(storage_options, db_path.data()); assert(s.ok()); From 5b84c43a03170fd26552c6f81cf1f2d357ec9cbd Mon Sep 17 00:00:00 2001 From: super-Pan66 <1719739132@qq.com> Date: Mon, 29 Apr 2024 20:20:02 +0800 Subject: [PATCH 11/12] code format --- src/cmd_admin.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cmd_admin.cc b/src/cmd_admin.cc index af5ee59d8..8f8907c03 100644 --- a/src/cmd_admin.cc +++ b/src/cmd_admin.cc @@ -6,8 +6,8 @@ */ #include "cmd_admin.h" -#include "pikiwidb.h" #include "db.h" +#include "pikiwidb.h" #include "pstd/env.h" #include "store.h" @@ -64,7 +64,7 @@ void FlushdbCmd::DoCmd(PClient* client) { storage::StorageOptions storage_options; storage_options.options = g_config.GetRocksDBOptions(); auto cap = storage_options.db_instance_num * kColumnNum * storage_options.options.write_buffer_size * - storage_options.options.max_write_buffer_number; + storage_options.options.max_write_buffer_number; storage_options.options.write_buffer_manager = std::make_shared(cap); storage_options.table_options = g_config.GetRocksDBBlockBasedTableOptions(); @@ -101,7 +101,7 @@ void FlushallCmd::DoCmd(PClient* client) { storage::StorageOptions storage_options; storage_options.options = g_config.GetRocksDBOptions(); auto cap = storage_options.db_instance_num * kColumnNum * storage_options.options.write_buffer_size * - storage_options.options.max_write_buffer_number; + storage_options.options.max_write_buffer_number; storage_options.options.write_buffer_manager = std::make_shared(cap); storage_options.table_options = g_config.GetRocksDBBlockBasedTableOptions(); @@ -109,7 +109,7 @@ void FlushallCmd::DoCmd(PClient* client) { storage_options.small_compaction_threshold = g_config.small_compaction_threshold.load(); storage_options.small_compaction_duration_threshold = g_config.small_compaction_duration_threshold.load(); storage_options.db_instance_num = g_config.db_instance_num; - storage_options.db_id = static_cast(i); + storage_options.db_id = static_cast(i); storage::Status s = PSTORE.GetBackend(i)->GetStorage()->Open(storage_options, db_path.data()); assert(s.ok()); From 603e4c0b6f0065e4bbb62b69cd94e5c84f57ba2f Mon Sep 17 00:00:00 2001 From: "Xin.Zh" Date: Mon, 6 May 2024 21:40:21 +0800 Subject: [PATCH 12/12] Update cmd_admin.cc --- src/cmd_admin.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cmd_admin.cc b/src/cmd_admin.cc index 3904eff8d..253211835 100644 --- a/src/cmd_admin.cc +++ b/src/cmd_admin.cc @@ -259,4 +259,3 @@ void InfoCmd::InfoData(PClient* client) { } } // namespace pikiwidb -