Commit graph

1972 commits

Author SHA1 Message Date
Eric Lippmann
87832d43bd Enable tests for custom var flat runtime sync 2021-10-26 09:31:41 +02:00
Eric Lippmann
e433aa7ec3 Move custom var sync to a new method 2021-10-26 09:31:41 +02:00
Eric Lippmann
5b18a7dd93 Respect context in custom var sync 2021-10-26 09:31:41 +02:00
Eric Lippmann
65440ee8fe Expect no custom var clear events during runtime 2021-10-26 09:31:41 +02:00
Eric Lippmann
b48792cf36 Handle flat custom vars explicitly in runtime updates
This also requires explicit handling of custom variables as we need
to multiplex the original values to handle flat custom variables.
2021-10-26 09:31:41 +02:00
Eric Lippmann
4d65c62f77 Handle contracts.Initer in common.NewSyncSubject()
contracts.EntitiyFactoryFunc.WithInit() checked for
contracts.Initer every time.
Now it is only done once in common.NewSyncSubject().
2021-10-26 09:31:36 +02:00
Eric Lippmann
c78326ad1b Use SyncSubject in RuntimeUpdates.Sync() 2021-10-26 09:27:00 +02:00
Eric Lippmann
fe6915447e Add method SyncSubject.Name() 2021-10-26 09:27:00 +02:00
Eric Lippmann
cacc710ff6 Use ExpandCustomvars() and synctx instead of ctx 2021-10-26 09:27:00 +02:00
Eric Lippmann
a73a882c6f Introduce function ExpandCustomvars() 2021-10-26 09:27:00 +02:00
Eric Lippmann
d017a05d05 Export DB.getSemaphoreForTable() 2021-10-26 09:27:00 +02:00
Eric Lippmann
16dd4663ad Move method DB.getSemaphoreForTable() 2021-10-26 09:27:00 +02:00
Eric Lippmann
44b45fc429 Use context from errgroup 2021-10-26 09:27:00 +02:00
Alexander Aleksandrovič Klimov
d9c626ced8
Merge pull request #383 from Icinga/feature/icingadb-schema-version
Only do anything while icinga:schema version meets our expectations
2021-10-25 15:49:58 +02:00
Alexander Aleksandrovič Klimov
6404864c3d
Merge pull request #382 from Icinga/feature/states-first
Sync state runtime updates ASAP
2021-10-19 17:53:50 +02:00
Alexander A. Klimov
b5e024e68d Sync state runtime updates ASAP
I.e. don't wait for the complete initial sync first.
2021-10-14 10:15:28 +02:00
Julian Brost
9216c10625
Merge pull request #378 from Icinga/systemd-journald
Allow to configure logging output and support systemd-journald
2021-10-13 16:14:03 +02:00
Julian Brost
682e3cb496
Merge pull request #215 from Icinga/add-missing-customvar-indices
Add missing indices to *_customvar tables
2021-10-13 16:13:29 +02:00
Eric Lippmann
c9914a1668 Notify systemd that Icinga DB finished starting up 2021-10-13 09:46:12 +02:00
Eric Lippmann
537a4cf37f Allow to configure the logging output 2021-10-13 09:46:12 +02:00
Eric Lippmann
a9afcea25c Allow systemd-journald (and console) as log outputs 2021-10-13 09:46:12 +02:00
Eric Lippmann
b582995e37 Introduce zapcore.Core that sends logs to systemd-journald 2021-10-13 09:46:12 +02:00
Eric Lippmann
9e49b62c4d Use the app name as the default logger name 2021-10-13 09:46:12 +02:00
Eric Lippmann
3061e3d0c5 Introduce function utils.AppName() 2021-10-13 09:46:12 +02:00
Eric Lippmann
66d34b4a9f Add ConvertCamelCase utility function 2021-10-13 09:46:12 +02:00
Eric Lippmann
bdeed69337 Move logging from internal to pkg 2021-10-13 09:20:55 +02:00
dependabot[bot]
5bc5d1516e
Bump github.com/go-redis/redis/v8 from 8.11.3 to 8.11.4
Bumps [github.com/go-redis/redis/v8](https://github.com/go-redis/redis) from 8.11.3 to 8.11.4.
- [Release notes](https://github.com/go-redis/redis/releases)
- [Changelog](https://github.com/go-redis/redis/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-redis/redis/compare/v8.11.3...v8.11.4)

---
updated-dependencies:
- dependency-name: github.com/go-redis/redis/v8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-11 10:02:15 +00:00
Eric Lippmann
d8ba0c374a
Merge pull request #364 from Icinga/feature/history-sync-foreign-keys
Add foreign key constraints to history tables
2021-10-07 18:38:33 +02:00
Julian Brost
c701b68e2a
Merge pull request #376 from Icinga/bugfix/lost-heartbeat-events
Reliably handle heartbeat events in HA and stop writing a heartbeat to the DB after it expires and hand over
2021-10-06 14:54:07 +02:00
Alexander A. Klimov
17dc99b078 Only do anything while icinga:schema version meets our expectations
... not to work on unknown data structure.
2021-10-06 12:11:16 +02:00
Julian Brost
e3ebf15f53 History sync: add benchmark 2021-10-05 18:35:02 +02:00
Ravi Kumar Kempapura Srinivasa
bab2d80ada Add foreign key with cascade delete constraints to history tables
Earlier we did not have any foreign keys for history table. But when we delete a record from the parent
history table the corresponding records in their child tables must also be deleted. This is done with the
introduction of foreign key constraints with on cascade delete.
2021-10-05 18:35:02 +02:00
Julian Brost
7c782e3eb8 History sync: use information from notification stream for user_notification_history table 2021-10-05 18:35:02 +02:00
Julian Brost
8b4e4d68a6 History sync: use indefinitely blocking XREAD
Just like we do it throughout the rest of the code.
2021-10-05 18:35:02 +02:00
Julian Brost
bfcc324535 History sync: rewrite to use a sequential pipeline
This is in preparation for adding foreign key constraints to the history
tables. For this, is is required to insert the rows into the different history
tables in a defined order.
2021-10-05 18:35:02 +02:00
Julian Brost
82530c771d Redis/DB: export options member
This change allows the history sync to use values configured in these options.
2021-10-05 18:34:55 +02:00
Johannes Meyer
830dc20976 mysql.schema.sql: Add missing indices to *_customvar tables 2021-10-05 15:03:58 +02:00
Julian Brost
c5af0cd287 HA: only set realize timeout when active
When inactive, this is the only query running so it has to retry for longer to
eventually trigger a fatal error if the database is gone for too long (5
minutes at the moment).
2021-10-04 16:58:35 +02:00
Julian Brost
239d2ea410 HA: after heartbeat expiry, stop writing to database and hand over
If it's not possible for Icinga DB to write through the heartbeat within its
validity period it cannot signal to other instances that it still is alive and
has the hand over. There's also no point in retrying for this individual
heartbeat any longer.
2021-10-04 16:58:35 +02:00
Julian Brost
a34aef4fc5 retry: if stopped due to outer context, return that error
If there is an outer context that is canceled or exceeds its deadline before
the internal timeout is reached, its error should be passed on as the failure
didn't happen due to retry giving up.
2021-10-04 16:58:35 +02:00
Julian Brost
217ab03e59 heartbeat: wrap messages with a timestamp
Track when a heartbeat was received to allow other components to check when it
will expire.
2021-10-04 16:58:35 +02:00
Julian Brost
8b2cb3acb8 heartbeat: use a single channel for all beat/loss events
Using Cond does not allow to reliably catch all events as one will only receive
events that occour after starting to listen. For heartbeat loss events it's
import to reliably catch them to not remain in an HA active state incorrectly.

fixes #360
2021-10-04 16:36:09 +02:00
Julian Brost
a1b78e0f23 Add XMessageBulker
Generics would be nice but we don't have them yet unfortunatly, so for now, yet
another copy of Bulker (as it already exists for EntityBulker).
2021-10-04 14:44:50 +02:00
Julian Brost
fccf76775c History sync: add integration tests 2021-10-04 14:44:50 +02:00
Alexander Aleksandrovič Klimov
d99e0586a5
Merge pull request #236 from Icinga/feature/tls
Support TLS
2021-10-04 12:27:21 +02:00
Alexander A. Klimov
82c26b187e Support TLS 2021-09-30 12:25:23 +02:00
Eric Lippmann
d5bca61e04
Merge pull request #366 from Icinga/child-loggers
Child loggers
2021-09-29 11:30:35 +02:00
Eric Lippmann
3bf49a224c
Merge pull request #374 from Icinga/feature/longtext-260
Schema: s/mediumtext/longtext/
2021-09-29 10:16:16 +02:00
Ravi Kumar Kempapura Srinivasa
650b6c61a6 Document logging configuration 2021-09-28 17:30:40 +02:00
Ravi Kumar Kempapura Srinivasa
f8e9290618 Use child loggers 2021-09-28 17:30:11 +02:00