-
Notifications
You must be signed in to change notification settings - Fork 281
Open
Labels
area/configurationAffects the configurationAffects the configuration
Description
Preparations
- Checkout db: Add tables and models for config storage #4778 and base off a new branch from it.
- Apply the migration scripts for version 2.11 to the mysql and postgresql database.
- Checkout Select: Add support for locking clauses ipl-sql#55, you'll need it
Goal
If there are multiple users updating the same configuration at the same time, no change must be ignored or overridden without explicit user action.
Assuming there are two users:
| User A | User B |
|---|---|
| opens config | |
| opens config | |
| submits changes | |
| submits changes | |
| succeeds | |
| fails |
If the update fails, the user must be informed about it. In addition, the new configuration values should be shown in a message at the top of the form.
Tasks
- Add a new validator to
ConfigForm(You may need to extend methodisValid()to achieve this as it should be a validator for the entire form) - Fetch the
hashfor the configuration's scope and compare it against the one sent in the form data (That's a task of AdjustConfigFormto write configurations to database #4779)- Apply a locking clause to the query to ensure you'll get a result only if there's noone writing to it. (See
FOR UPDATE)
- Apply a locking clause to the query to ensure you'll get a result only if there's noone writing to it. (See
- If the hashes don't match
- fetch the new config options from database
- show a message at the top of the form (
$this->warning) and list the new options there - forget the old hash and set the new hash so that the next submit includes it (Otherwise the validation fails again)
- let the form validation fail
Hints
You can fake another user by running a transaction on the database in the console with a sleep in it:
begin;
update icingaweb_config_scope ... ;
do sleep(60);
commit;
Metadata
Metadata
Assignees
Labels
area/configurationAffects the configurationAffects the configuration