-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#329] Implement a command to change a configuration value
This commit introduces the `config-set` in `pgagroal-cli` to allow the user to ask the pooler to change a configuration setting. As a simple usage example: pgagroal-cli config-set log_level debug The idea is to write over the communication socket the parameter name and the parameter value, so that the system can understand what has to do. In order to achieve the capability to dynamically set a single parameter, a new utility function named 'pgagroal_appy_main_configuration' has been created. Such function is now the backbone of the configuration reading process. Other internal functions have been added to easily manage the dynamic changes of pieces of structures, e.g., `struct hba` and alike. The code that loads the initial configuration out of the configuration files has been refactored in order to use these new utility functions so to keep the whole system coherent. When a request to dynamically change a single parameter arrives, the system creates a clone of the currently running configuration, than try to apply on such a clone the new setting, and in the case of success, swaps the cloned configuration with the currently running one, so that the currently running one becomes the (changed) cloned. In the case of failure, e.g., if the configuration change cannot be applied because it requires a restart, the cloned configuration is destroyed and the system keeps running with the previous one. The answer of a `config-set` command is a `config-get` for the same setting, that is the system sends over the communication socket the value of the setting requested to be changed. If the final value has changed, the `pgagroal-cli` will receive the new value, otherwise if the old value is kept, the old value will be sent. This allows for automation of `pgagroal-cli config-set` usage, so that it becomes easy to test back when a parameter have been applied. The `pgagroal-cli` is responsible to understand if the change did take effect, so it does compare the sent value with the received answer, and if they are the same it assumes there was an error. In case of failure, a return error code is returned, otherwise zero on success. If the `pgagroal-cli` is used with the verbose flag, the ending result will print out the status of the command and the value of the setting as done by `config-get`. This commit also changed some management debug levels to `debug` consistently between `config-get` and `config-set` implementations. Documentation updated. Shell completions updated. Close #329
- Loading branch information
1 parent
bd8168b
commit 2990214
Showing
10 changed files
with
1,206 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.