Yonas Habteab
43ba2da39c
Replace std/boost::bind() function with lambda expression
2021-03-10 16:29:40 +01:00
Alexander Aleksandrovič Klimov
3f4b09f01c
Merge pull request #8488 from Icinga/feature/improve-config-sync-locking
...
Improve config sync locking
2020-11-27 17:55:15 +01:00
Noah Hilverling
83b4d8e69d
Config sync: Only remove files, if timestamp changed
2020-11-24 10:44:38 +01:00
Julian Brost
70c9d49ebc
ApiListener: merge new config validation and actication functions
...
Merge AsyncTryActivateZonesStage and TryActivateZonesStageCallback and
name the result TryActivateZonesStage. The old split was a leftover from
the one being a callback function with no actual meaningful separation.
2020-11-17 09:37:13 +01:00
Julian Brost
e4610e7dbd
Use std::mutex instead of Spinlock
2020-11-16 17:38:03 +01:00
Julian Brost
74b65f1642
API filesync: wait for validation process to exit
...
This avoid having to pass a lock implictly using the captured variables
of a lambda.
2020-11-16 17:10:57 +01:00
Alexander Aleksandrovič Klimov
f60ae93717
Merge pull request #7870 from Icinga/bugfix/last-zone-sync-stage-validation-failed-7642
...
Clear ApiListener#last_failed_zones_stage_validation on config::Update if config not changed
2020-10-19 12:31:01 +02:00
Alexander Aleksandrovič Klimov
4bb6f4c910
Merge pull request #8364 from Icinga/bugfix/configsyncstagelock-unlock-owner-213
...
Make ApiListener::m_ConfigSyncStageLock a SpinLock
2020-10-14 16:01:00 +02:00
Alexander A. Klimov
fbfa931b31
Clear ApiListener#last_failed_zones_stage_validation on config::Update if config not changed
...
refs #7642
2020-10-14 12:17:14 +02:00
Alexander A. Klimov
a083635de4
Make ApiListener::m_ConfigSyncStageLock a SpinLock
2020-10-14 10:47:08 +02:00
Julian Brost
e04d618ede
Catch exceptions in the thread running HandleConfigUpdate
...
With dc3062a9b0
, exceptions in this code
path were no longer caught properly. This commit restores exception
handling for this function.
2020-10-13 14:07:44 +02:00
Alexander A. Klimov
38f3108c1a
ApiListener::HandleConfigUpdate(): make the whole process mutually exclusive
...
refs #7742
2020-03-23 17:33:14 +01:00
Alexander A. Klimov
dc3062a9b0
ApiListener::ConfigUpdateHandler(): block as less as possible
...
refs #7742
2020-03-23 17:31:59 +01:00
Michael Friedrich
cdfc6e6f50
Cluster config sync: Use a more friendly message when configs are equal and don't need a reload
...
This also adds an entry to the troubleshooting docs.
2020-02-05 15:31:41 +01:00
Michael Friedrich
cb20b4829a
Cluster Config Sync: Check the timestamp prior to config file checksums
...
Otherwise old configuration received from a secondary master/satellite
could always trigger a config change & reload.
2019-10-22 14:07:10 +02:00
Michael Friedrich
e7c07062f8
Avoid syncing .authorititative marker received from < 2.11 parent nodes
2019-10-02 10:49:02 +02:00
Michael Friedrich
c42a2583f0
Cluster sync: Only sync valid UTF8 content (text config, no binaries)
...
- *.conf files are sanitized automatically.
- Other files detect sanitizing and treat that as unsupported type
refs #7382
2019-08-02 16:06:32 +02:00
Michael Friedrich
eff6e7662c
Fix style and comments
2019-07-15 09:54:35 +02:00
Diana Flach
5fbc052aba
Cluster Sync: Improve log messages
2019-07-15 09:54:26 +02:00
Michael Friedrich
b00e1d0c67
Config sync: Count the updates and log them
...
```
[2019-07-10 12:34:27 +0200] information/ApiListener: Received configuration updates (2) from endpoint 'master1' are equal to production, not triggering reload.
```
2019-07-15 09:54:09 +02:00
Diana Flach
87d4575af8
Cluster Sync: Ensure that files are synced everytime
2019-07-15 09:53:47 +02:00
Michael Friedrich
46287c92e6
Cluster: Avoid checking for checksum length with internal files in use
...
fixes #7282
2019-07-04 13:52:31 +02:00
Janne Heß
3e801fbd5a
Fix Path to staged files
...
The paths in the list are relative, not absolute to the stage directory.
2019-06-26 02:04:06 +02:00
Michael Friedrich
08a47600be
Config sync: Only copy paths to prod which are actually there
...
Stored files may be removed by external sources.
2019-06-19 17:00:50 +02:00
Michael Friedrich
db4cc13770
Config Sync: Only log config files for stage, no metadata
2019-06-19 16:09:16 +02:00
Michael Friedrich
577e42e137
Quality: Comments and logs in cluster config sync
2019-06-19 14:46:11 +02:00
Michael Friedrich
3852c51c9f
Cluster sync: Don't load/sync the .authoritative config file marker
...
This would influence everything else, and it isn't needed anywhere
but the master instance (zones.d -> var-zones).
2019-06-19 14:46:11 +02:00
Michael Friedrich
0aa6f1a3b3
Use boost::filesystem & Utility classes for file IO
2019-06-19 14:46:11 +02:00
Michael Friedrich
6add9f9ecb
Avoid concurrent cluster config sync transactions
...
fixes #6660
2019-06-19 14:46:11 +02:00
Michael Friedrich
af8624dcf1
Apply ReloadTimeout for 2.11
2019-06-19 14:46:11 +02:00
Michael Friedrich
b3b7abdfe8
Spam the log with config file copies from stage to prod
2019-06-19 14:46:11 +02:00
Michael Friedrich
4c6150b254
Improve checksum logic and logging
2019-06-19 14:46:11 +02:00
Michael Friedrich
f92f6f7f8c
Improve checksum checks for each file content
2019-06-19 14:46:11 +02:00
Michael Friedrich
a6ddef17d9
Enhace logging when config change yes/no will trigger further reload actions
2019-06-19 14:46:11 +02:00
Michael Friedrich
c230e503e6
Fix global checksum calculation
2019-06-19 14:46:11 +02:00
Michael Friedrich
7a02990ef8
Refactor the client sync, part II (WIP, currently checksums generate an endless loop)
2019-06-19 14:46:11 +02:00
Michael Friedrich
6105ace50f
Improve variable names in ApiListener::SendConfigUpdate()
2019-06-19 14:46:11 +02:00
Michael Friedrich
a4b48fc7f4
Update code docs
2019-06-19 14:46:11 +02:00
Michael Friedrich
fcc1799a5d
Split config file sync updates, part I
...
This commit also introduces a playground for checksums,
whilst refactoring the code in large parts.
2019-06-19 14:46:11 +02:00
Michael Friedrich
9df389a843
Improve logging for ignored config updates where we are authoritative for (config master)
2019-06-19 14:46:11 +02:00
Michael Friedrich
efc2289178
Remove duplicated validation paths in function signatures
2019-06-19 14:46:11 +02:00
Michael Friedrich
043824a6a9
Leave partial deletes as is, this is dealt with stage purge later
2019-06-19 14:46:11 +02:00
Michael Friedrich
b3fa51a5dc
Code Documentation: Config file sync
...
Adds headers to all functions including parameters. This unveils
certain unused ones too.
2019-06-19 14:46:11 +02:00
Michael Friedrich
604a8a041d
Update log message and implement recursive diff delete
2019-06-19 14:46:11 +02:00
Michael Friedrich
2acf3a6941
Indicate a warning in the 'icinga' check when cluster stage validation failed
...
- success: clear the last failed attribute
- failed: populate it with the output and current timestamp
This can be used to highlight this in the 'icinga' check task.
Since 2.9 we don't have problems with circular library dependencies
with just one linked binary, therefore it is safe to include libremote
in libmethods here.
2019-06-19 14:46:11 +02:00
Michael Friedrich
46cb806b3f
Add a note for config updates V1 and V2
...
Old clients sync !.conf via update_v2 message, we cannot
remove this handling for the time being.
2019-06-19 14:46:11 +02:00
Michael Friedrich
83c11962b2
Only remove directories if they exist during sync
2019-06-19 14:46:11 +02:00
Michael Friedrich
4e9439f2d8
Ensure that config master zones.d -> var-api-zones sync removes deleted files
2019-06-19 14:46:11 +02:00
Michael Friedrich
9d53db1401
Purge stage and production directories before copying files
...
The cluster-message -> production diff is still intact, we're
just taking care of unwanted/deleted files here.
2019-06-19 14:46:11 +02:00
Michael Friedrich
86108e6a1e
Improve logging and code quality
2019-06-19 14:46:11 +02:00