Commit Graph

21 Commits

Author SHA1 Message Date
Alexander A. Klimov dc4869c3aa IcingaDB::TimestampToMilliseconds(): limit output to four year digits
Too high timestamps may overflow uint64_t (and the YYYY format) and negative
ones don't fit into uint64_t. Those may crash our Go daemon.
2024-09-30 16:54:40 +02:00
Yonas Habteab 85c77bd878 IcingaDB: Cache generated object hash 2022-09-12 17:23:06 +02:00
Julian Brost 9630e86997 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-09 14:29:44 +01:00
Noah Hilverling 73e0d6e61b Icinga DB: Make sure object relationships are handled correctly 2021-11-12 13:34:57 +01:00
Noah Hilverling 0b9317a5bf 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-05 17:01:40 +01:00
Julian Brost 525dd50859 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-05 14:14:37 +01:00
Alexander A. Klimov b1714a10c2 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-02 15:00:03 +01:00
Alexander A. Klimov 5c44365c4e 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-02 15:00:03 +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