19 Commits

Author SHA1 Message Date
Julian Brost
de8960feaa Add missing array locking in IcingaDB::GetArrayDeletedValues()
icinga::Array requires locking by the caller when iterating using Begin() and
End(). This is only checked in debug builds but there it makes this function
fail.
2022-03-29 15:54:07 +02:00
Noah Hilverling
2d2b165a79 Icinga DB: Make sure object relationships are handled correctly 2021-11-12 17:55:47 +01:00
Noah Hilverling
d164d66808 IcingaDB: Remove GetObjectIdentifiersWithoutEnv()
Having the command type be a part of the command ID isn't needed anywhere. Removing this simplifies the way we generate IDs in general, because we don't need Prepend() anymore.

The command type was only needed to prevent ID collisions within the command_envvar and command_argument tables. Those tables have since been separated into {check,event,notification}command_envvar and {check,event,notification}command_argument tables.
2021-11-12 10:18:33 +01:00
Julian Brost
42fc3cdcfc IcingaDB: introduce a new environment ID derived from the CA public key
In order to avoid changes to the environment ID, it is now no longer derived
from the Environment constant but instead from the public key of the CA
certificate. This ensures that it is different between clusters by default, so
no additional changes have to be done to allow two clusters to use Icinga DB to
write into the same database.

To prevent the ID from changing when the CA certificate is replaced, it is also
persisted into the file /var/lib/icinga2/icingadb.env, so if that file exists,
it takes precedence over the CA certificate.
2021-11-11 16:58:16 +01:00
Alexander A. Klimov
1b06444b8d Icinga DB: make icinga:history:stream:*#event_id deterministic
... i.e. UUID -> SHA1(env, eventType, x...) given that SHA1(env, x...) = type-specific ID.
Rationale: allow both masters to write the same history concurrently (while not
in split-brain), so that REPLACE INTO deduplicates the same events written twice.

* ack: SHA1(env, "ack_set"|"ack_clear", checkable.name, setTime)
* comment: SHA1(env, "comment_add"|"comment_remove", comment.name)
* downtime: SHA1(env, "downtime_start"|"downtime_end", downtime.name)
* flapping: SHA1(env, "flapping_start"|"flapping_end", checkable.name, startTime)
* notification: SHA1(env, "notification", notification.name, notificationType, sendTime)
* state: SHA1(env, "state_change", checkable.name, changeTime)
2021-11-10 17:24:55 +01:00
Alexander A. Klimov
6a75d5121b Icinga DB: make icinga:history:stream:notification#id deterministic
... i.e. UUID -> SHA1(x..., send time) given that SHA1(x...) = notification id.
Rationale: allow both masters to write the same notification history concurrently (while
not in split-brain), so that REPLACE INTO deduplicates the same events written twice.
2021-11-10 17:24:55 +01:00
Noah Hilverling
4005d81a43 Icinga DB: Sync state using runtime updates 2021-05-07 08:41:38 +02:00
Noah Hilverling
ab04a4ee98 Icinga DB: Sync runtime updates using streams 2021-05-07 08:41:38 +02:00
Alexander A. Klimov
78189d70ef IcingaDB: don't hash hashes
refs #7692
2019-12-10 11:23:05 +01:00
Alexander A. Klimov
d69cb676a7 Introduce IcingaDB#GetObjectIdentifiersWithoutEnv()
refs #7692
2019-12-10 11:22:35 +01:00
Alexander A. Klimov
783586978f Get rid of IcingaDB#CalculateCheckSumProperties()
refs #7691
2019-12-06 11:25:41 +01:00
Alexander A. Klimov
9a678dce8e Get rid of IcingaDB#CalculateCheckSumVars()
refs #7691
2019-12-06 11:24:33 +01:00
Alexander A. Klimov
b5ada44330 Get rid of IcingaDB#CalculateCheckSumMetadata()
refs #7691
2019-12-06 11:23:13 +01:00
Alexander A. Klimov
c91154a14c Get rid of IcingaDB#CalculateCheckSumString()
refs #7691
2019-12-06 10:54:11 +01:00
Alexander A. Klimov
6fc4efccc7 Get rid of IcingaDB#CalculateCheckSumArray()
refs #7691
2019-12-06 10:47:48 +01:00
Michael Friedrich
9d9804d50a Styleguide for IcingaDB 2019-11-02 18:01:31 +01:00
Michael Friedrich
61d9130dd0 Fix Copyright headers 2019-11-02 14:00:24 +01:00
Michael Friedrich
f9b3e88bbb Fix non-unity builds 2019-11-02 14:00:24 +01:00
Alexander Aleksandrovič Klimov
13ab7eb609 Rename redis to icingadb 2019-11-02 14:00:24 +01:00