Yonas Habteab
834709543a
ApplyRule: Make `m_HasMatches` atomic
...
This prevents the `m_HasMatches` property from being altered simultaneously.
This might seem harmless (since this property can only be set to true by any calling thread),
however, from a technical (C++) point of view, this constitutes a data race.
2022-11-28 14:13:58 +01:00
Julian Brost
ae32b3cbbd
Merge pull request #9586 from Icinga/9363
...
icinga2 daemon: write icinga2.debug only if --dump-objects given
2022-11-24 16:03:42 +01:00
Alexander A. Klimov
f71612d8f3
icinga2 object list: warn on possibly outdated config
2022-11-24 10:50:17 +01:00
Alexander A. Klimov
0767c6ef87
icinga2 daemon -C: write icinga2.debug only if --dump-objects given
...
to save config (re)load time.
2022-11-23 12:54:33 +01:00
Julian Brost
dd99a5ace9
Merge pull request #9577 from Icinga/ConfigItem-CommitNewItems
...
ConfigItem::CommitNewItems(): allow fast search of pending items by type
2022-11-23 12:34:51 +01:00
Alexander A. Klimov
ae693cb7e1
ConfigItem::CommitNewItems(): allow fast search of pending items by type
2022-11-21 15:07:39 +01:00
Alexander A. Klimov
33e609d791
Type#GetLoadDependencies(): avoid malloc()
...
- cache result
- return it by const ref
- do Type::GetByName() for the callers
2022-11-21 15:07:39 +01:00
Julian Brost
a958a735d7
Merge pull request #9555 from Icinga/ApplyRule-GetDebugInfo
...
ApplyRule#GetDebugInfo(): return by const ref to avoid malloc()
2022-11-16 13:35:04 +01:00
Alexander A. Klimov
e97a5d59e0
ApplyRule#GetFVVar(): return by const ref
...
to avoid malloc().
2022-11-08 12:48:13 +01:00
Alexander A. Klimov
738662338f
ApplyRule#GetFKVar(): return by const ref
...
to avoid malloc().
2022-11-08 12:45:21 +01:00
Julian Brost
98902b2ff0
Merge pull request #9545 from Icinga/targeted-apply-rules
...
Separately handle apply rules targetting only specific parent objects
2022-11-04 14:06:15 +01:00
Yonas Habteab
a8d46e6d47
Use service short name for evaluating targeted service rules
2022-11-04 10:19:26 +01:00
Yonas Habteab
2610fb1285
Avoid evaluating the same filter twice for the same target
2022-11-04 10:15:22 +01:00
Alexander A. Klimov
27a559c5fe
ApplyRule#GetDebugInfo(): return by const ref to avoid malloc()
2022-10-28 15:33:44 +02:00
Alexander A. Klimov
a698b9c3da
ApplyRule::RuleMap: reduce complexity, save unnecessary lookups
2022-10-28 14:27:53 +02:00
Alexander A. Klimov
a907c2ac9a
Targeted apply rules: don't unnecessarily eval filter
2022-10-28 14:27:53 +02:00
Alexander A. Klimov
dacd6a206d
VariableExpression#GetVariable(): return by const ref not to unnecessarily malloc()
2022-10-28 14:27:53 +02:00
Alexander A. Klimov
038a5e8ef6
Unify storages of regular/targeted apply rules: std::vector<ApplyRule::Ptr>
2022-10-28 14:27:53 +02:00
Alexander A. Klimov
a56ad38ad3
Separately handle apply rules targetting only specific parent objects
...
not to unnecessarily run e.g. the filter assign where host.name=="example.com"
for all hosts being not example.com.
2022-10-28 14:27:53 +02:00
Alexander A. Klimov
fd7ac4e5ca
Allow hashmaps of String
2022-10-21 10:28:41 +02:00
Alexander A. Klimov
449a3c14cf
Allow intrusive pointers to ApplyRule
2022-10-21 10:28:41 +02:00
Julian Brost
987bb22397
Merge pull request #9543 from Icinga/apply-rules-lookup
...
Lookup apply rules faster by Type*, not String and by map instead of ==/!=
2022-10-21 09:53:35 +02:00
Alexander A. Klimov
c7d656716f
Remove unused ApplyRule#m_TargetType
2022-10-19 13:43:51 +02:00
Alexander A. Klimov
d468d7993c
Lookup apply rules faster by Type*, not String and by map instead of ==/!=
...
1. The lookup of apply rules per source type now implies
no String(const char*) (no malloc()) and just pointer (uint64) comparisions
2. Apply rules are now also grouped by target type via a nested map, that obsoletes
checking the target type while iterating over all rules per source type
2022-10-19 13:43:51 +02:00
Alexander A. Klimov
90fe4e5bea
ApplyRule::GetTargetTypes(): return by const ref not to malloc()
2022-10-19 13:43:51 +02:00
Julian Brost
f2563cc890
Merge pull request #9542 from Icinga/context-evaluating-apply-rules-for-host
...
Construct string once, not unnecessarily N times
2022-10-17 19:57:09 +02:00
Alexander A. Klimov
ce1a122618
Construct string once, not unnecessarily N times
2022-10-17 15:54:02 +02:00
Yonas Habteab
400117e2f6
ConfigItem: Don't add items to the new items vector before committing
...
This also improves the performance a bit, as we longer have to iterate over the items
and copy them into the new items vector.
2022-10-12 13:27:41 +02:00
Yonas Habteab
f7298e85d2
ConfigItem: Fix infinite recursion caused by `ignore_on_error` when committing an item
...
When committing an item with `ignore_on_error` flag set fails, the `Commit()` method only returns `nullptr`
and the current item is not being dropped from `m_Items`. `CommittNewItems()` also doesn't check the return
value of `Commit()` but just continues and tries to commit all items from `m_Items` in recursive call. Since
this corrupt item is never removed from `m_Items`, it ends up in an endless recursion till it finally crashes.
2022-10-12 13:15:09 +02:00
Julian Brost
91cbb856fe
Merge pull request #9521 from Icinga/noop-log-msgs
...
Logger: don't render log messages which will be disposed anyway
2022-10-11 19:05:03 +02:00
Alexander Aleksandrovič Klimov
363f4d3fde
Merge pull request #9408 from Icinga/bugfix/match-api-permissions-against-join-relations
...
ObjectQueryHandler: Check user permissions on joined relations
2022-10-11 13:42:27 +02:00
Yonas Habteab
a656444d78
RedisConnection: Don't log queries that are going to be discarded
2022-10-11 13:28:08 +02:00
Alexander A. Klimov
0fbb0332a6
Logger: don't render log messages which will be disposed anyway
...
by caching the total minimum log severity of all loggers in a
"global variable" and whether a message's severity is large enough for any of
the loggers in a per-message no-op flag.
2022-10-11 13:28:08 +02:00
Julian Brost
9be02e3f04
Merge pull request #9518 from Icinga/9481
...
StartUnixWorker(): watch forked child via waitpid(), not SIGCHLD handler
2022-10-10 14:36:52 +02:00
Yonas Habteab
72e6894bbb
Evaluate permission filters also on all joined relations
2022-10-10 12:33:33 +02:00
Yonas Habteab
607f7ab5ca
ObjectQueryHandler: Check user permissions on joined relations
2022-10-10 12:33:33 +02:00
Yonas Habteab
1bb2d65a8d
FilterUtility: Outsource permission matching from CheckPermission() to a separate method
2022-10-10 12:33:33 +02:00
Julian Brost
465da17060
Merge pull request #9407 from Icinga/bugfix/don-not-allow-changing-object-relations-at-runtime
...
Don't allow to change object navigation fields at runtime
2022-10-10 12:27:57 +02:00
Alexander A. Klimov
61f7e029cb
Replace two-variants enum with bool
2022-10-07 15:14:33 +02:00
Julian Brost
87a4925997
Merge pull request #9519 from Icinga/utf8cp
...
Utility::ValidateUTF8(): move a string instead of copying a vector
2022-10-07 10:21:37 +02:00
Julian Brost
2a4dc083ae
Merge pull request #9524 from Icinga/introduce-object-idx
...
Introduce object identifier attr
2022-10-07 10:19:59 +02:00
Julian Brost
0ed9c09a1d
Merge pull request #9513 from Icinga/9501
...
Icinga DB: on every check result update state only 1x, not 3x in a row
2022-10-07 10:18:56 +02:00
Yonas Habteab
85c77bd878
IcingaDB: Cache generated object hash
2022-09-12 17:23:06 +02:00
Yonas Habteab
07e60c1961
ConfigObject: Introduce new `icingadb_identifier` attr
2022-09-12 17:22:57 +02:00
Yonas Habteab
28c29c1fbc
Don't allow to change object parent,host/service_name at runtime
2022-09-09 18:26:28 +02:00
Alexander A. Klimov
a6b36a2d7b
Utility::ValidateUTF8(): move a string instead of copying a vector
...
less malloc() = more speed
Especially as JsonEncode() validates every single input string.
2022-09-09 10:50:42 +02:00
Alexander A. Klimov
22bfcf9ac5
icinga2 daemon: remove no-op SIGCHLD handling
...
1. Don't set a custom handler for SIGCHLD (in the umbrella process)
as that handler doesn't actually handle SIGCHLD anymore
2. Don't reset the SIGCHLD handler (in the worker process)
as there's nothing to reset anymore due to the above change
3. Don't block SIGCHLD across fork(2) as its handler doesn't change anymore
due to the above changes
2022-09-07 12:12:09 +02:00
Alexander A. Klimov
3de714489c
Remove unused UnixWorkerState::Failed
2022-09-07 12:08:33 +02:00
Alexander A. Klimov
df9008bfc4
StartUnixWorker(): watch forked child via waitpid(), not SIGCHLD handler
...
Before:
On SIGCHLD from the forked worker the umbrella process sets a failure flag.
StartUnixWorker() recognises that and does waitpid(), failure message, etc..
On OpenBSD we can't tell the signal source, so we always set the failure flag.
That's not how our IPC shall work, that breaks the IPC sooner or later.
After:
No SIGCHLD handling and no failure flag setting.
Instead StartUnixWorker()'s wait loop uses waitpid(x,y,WNOHANG)
to avoid false positives while watching the forked worker.
2022-09-07 11:46:46 +02:00
Yonas Habteab
31785b48fd
Expression: Decrease `frame.Depth` only when calling `IncreaseStackDepth()` succeeds
...
This ensures that `frame.Depth` is only decreased when preceding `frame.IncreaseStackDepth()` callee was successful.
This way, `frame.Depth` will have the same depth prior to and after evaluating a frame.
2022-09-07 09:41:16 +02:00