-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: dynamic reload duplication config #2103
base: master
Are you sure you want to change the base?
feat: dynamic reload duplication config #2103
Conversation
How to use?
What can it do?This PR can ONLY reload the parameter about duplication, so that it will be safety.
|
@@ -0,0 +1,106 @@ | |||
; The MIT License (MIT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Apache 2.0 license.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a config file that I copy the file header of src/common/test/config-test.ini
. And I don't know how to write the copyright owner of this config file.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
std::string value; | ||
int line; | ||
|
||
bool present; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add some comments when you happened to modify the code? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At begin I declaring configuration(config_map&)
to use the mutex lock the map. If I not move private parameter before public function, an error will be reported during the compilation phase: the variable cannot be found.
@@ -51,6 +51,20 @@ configuration::~configuration() | |||
_configs.clear(); | |||
} | |||
|
|||
void configuration::copy_configs(configuration &source_conf) | |||
{ | |||
source_conf._lock.lock(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_configs should be empty before filling values, right? Please check it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before I call configuration::copy_configs
, it will call configuration::clear_configs
to make _configs
clearly.
src/utils/config_api.cpp
Outdated
*old_config = g_config; | ||
dsn::configuration temp_config; | ||
if (!temp_config.load(file, arguments)) { | ||
// todo gns: add some error log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the standard TODO style.
Thanks for the contribution! Before this pull request, let's discuss clearly the requirement in #2102. |
What problem does this PR solve?
#2102
What is changed and how does it work?
If the cluster maintainer push new config to target cluster, you can use pegasus-shell to make cluster reload new duplication config without nodes restart.
I add some function to help servers get their config on time, and we can reload new config ONLY about duplication.
Tests
Code changes
Move and copy constructors of configuration class.
Some function about reloading dup parameter into memory instance.
Related changes