ruojieranyishen commented on code in PR #1511:
URL:
https://github.com/apache/incubator-pegasus/pull/1511#discussion_r1254212561
##########
src/server/pegasus_server_impl.cpp:
##########
@@ -2625,6 +2626,79 @@ pegasus_server_impl::get_restore_dir_from_env(const
std::map<std::string, std::s
return res;
}
+void pegasus_server_impl::update_rocksdb_dynamic_options(
+ const std::map<std::string, std::string> &envs)
+{
+ if (envs.size() == 0) {
+ return;
+ }
+ auto extract_option = [](const std::string &option) -> std::string {
+ std::stringstream ss(option);
+ std::string prefix, rocksdb_opt;
+ std::getline(ss, prefix, '.');
+ std::getline(ss, rocksdb_opt);
+ LOG_INFO("Extract rocksdb dynamic opt ({}) from ({})", rocksdb_opt,
option);
+ return rocksdb_opt;
+ };
+
+ std::unordered_map<std::string, std::string> new_options;
+ for (const auto &option : ROCKSDB_DYNAMIC_OPTIONS) {
+ auto find = envs.find(option);
+ if (find == envs.end()) {
+ continue;
+ }
+ new_options[extract_option(option)] = find->second;
+ }
+
+ // doing set option
+ if (new_options.empty() && set_options(new_options)) {
+ LOG_INFO("Set rocksdb dynamic options success");
+ }
+}
+
+void pegasus_server_impl::set_rocksdb_options_before_creating(
+ const std::map<std::string, std::string> &envs)
+{
+ if (envs.size() == 0) {
+ return;
+ }
+
+ for (const auto &option : pegasus::ROCKSDB_STATIC_OPTIONS) {
+ auto find = envs.find(option);
+ if (find == envs.end()) {
+ continue;
+ }
+ bool is_set = false;
+ if (option.compare(ROCKSDB_NUM_LEVELS) == 0) {
Review Comment:
Thanks for your detailed advice. I run unit tests to ensure new rocksdb
options are not forgotten to be added. Sorry for getting back to you so late, I
mainly modified the following aspects:
- Add setter and getter methods for each rocksdb option.
- Add unit tests.
- create app with rocksdb option.
`src/meta/test/meta_app_operation_test.cpp`
- update app envs with rocksdb option.
`src/meta/test/meta_app_envs_test.cpp`
- create pegasus_server_impl with rocksdb option.
‘src/server/test/pegasus_server_impl_test.cpp’
- restart pegasus_server_impl with rocksdb option.
‘src/server/test/pegasus_server_impl_test.cpp’
About lines 385 to 484 in src/meta/test/meta_app_operation_test.cpp are
caused by clang-format. I want to adjust later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]