In https://github.com/tikv/tikv/pull/9061 a slow log config item is added. It can be further extended to support dynamic modification.
A dynamic config modification is performed from TiKV-Control command line (documentation)
Hi @breeswish, I'm trying to get familiar with tikv ahead of GSoC and wanted to give this a shot. Do you mind helping with some pointers?
I don't know if it's right but it seems based on this, that configs under the server field are marked as "skip" and cannot be modified dynamically at the moment.
Hi @idoqo #[config(skip)] is used to check if we try to change a config that not support changing dynamically. To support changing server.end_point_slow_log_threshold dynamically, we need to replace #[config(skip)] with #[config(submodule)] for server and which will require server::Config to derive the Configuration trait and to dispatch the changes to where the config actually used, we also need to implement a ConfigManager. Take backup for example, here is what we need to do:
https://github.com/tikv/tikv/blob/0632bd27a0062a2e21e0cdc88753a9f906f85fbe/src/config.rs#L2261-L2262
https://github.com/tikv/tikv/blob/0632bd27a0062a2e21e0cdc88753a9f906f85fbe/src/config.rs#L2145-L2150
https://github.com/tikv/tikv/blob/0632bd27a0062a2e21e0cdc88753a9f906f85fbe/components/backup/src/endpoint.rs#L379-L387
https://github.com/tikv/tikv/blob/0632bd27a0062a2e21e0cdc88753a9f906f85fbe/cmd/src/server.rs#L800-L803
https://github.com/tikv/tikv/blob/0632bd27a0062a2e21e0cdc88753a9f906f85fbe/components/backup/src/endpoint.rs#L779
@NingLin-P @breeswish
I've created a draft PR for this but I'm still a bit confused about a few things. For example:
I'm correctly binding the server Config to the ServerConfigManager with Arc<RwLock<Config>>, but I'm not sure if it's the right way to do that.
Should we mark all the other fields of the server Config struct as skip, since endpoint-slow-log-threshold is the only one we want to make changeable (for now).
@idoqo
I'm correctly binding the server Config to the ServerConfigManager with Arc
>, but I'm not sure if it's the right way to do that.
It is okay to use Arc<RwLock<Config>>
Should we mark all the other fields of the server Config struct as skip, since endpoint-slow-log-threshold is the only one we want to make changeable (for now).
Yes, we need to mark all the other fields of the server Config struct as skip
Yes, we need to mark all the other fields of the server Config struct as skip
Alright, thanks a lot! I've marked the PR as ready for review now (though I haven't been able to figure out why the CI is failing).
Most helpful comment
Hi @idoqo
#[config(skip)]is used to check if we try to change a config that not support changing dynamically. To support changingserver.end_point_slow_log_thresholddynamically, we need to replace#[config(skip)]with#[config(submodule)]forserverand which will requireserver::Configto derive theConfigurationtrait and to dispatch the changes to where the config actually used, we also need to implement aConfigManager. Takebackupfor example, here is what we need to do:https://github.com/tikv/tikv/blob/0632bd27a0062a2e21e0cdc88753a9f906f85fbe/src/config.rs#L2261-L2262
https://github.com/tikv/tikv/blob/0632bd27a0062a2e21e0cdc88753a9f906f85fbe/src/config.rs#L2145-L2150
https://github.com/tikv/tikv/blob/0632bd27a0062a2e21e0cdc88753a9f906f85fbe/components/backup/src/endpoint.rs#L379-L387
https://github.com/tikv/tikv/blob/0632bd27a0062a2e21e0cdc88753a9f906f85fbe/cmd/src/server.rs#L800-L803
https://github.com/tikv/tikv/blob/0632bd27a0062a2e21e0cdc88753a9f906f85fbe/components/backup/src/endpoint.rs#L779