Commit graph

58 commits

Author SHA1 Message Date
Alvar Penning
27d27d4539
schema: Fix values to fit by increasing type sizes
The icon_image_alt column in both the host and service tables contains
an image alt text. However, because it is defined as a varchar(32), many
alt texts do not fit. The type has been expanded to text, as with most
free text fields.

Closes #752.

When defining a TimePeriod, the maximum length of a range value was
capped at 255 characters. This limitation has now also been removed by
switching to the Text type.

Closes #724.

While re-reading the schema, I stumbled upon some missing
properties_checksum comments that were also added.
2024-07-30 10:38:19 +02:00
Alexander A. Klimov
2681634105 Unify check attempt data type to uint32 already used somewhere
A float isn't necessary as in Icinga 2 Checkable#max_check_attempts and
check_attempt are ints. But uint8 isn't enough for e.g. 1 check/s to get
HARD after 5m (300s > 255).
2024-04-08 16:01:53 +02:00
Yonas Habteab
2a0da3dec1 Add a correct composite INDEX for the history table 2024-04-05 15:43:20 +02:00
Eric Lippmann
dd75a5edbc schema/mysql: Use UNIX_TIMESTAMP() instead of CURRENT_TIMESTMAP()
`CURRENT_TIMESTAMP()` an alias for `NOW()` returns the current date and
time in the format `YYYY-MM-DD hh:mm:ss` using the session time zone.
Since we are using numeric context, the value is stored in the format
`YYYYMMDDhhmmss`. But actually we want to set a (millisecond) UNIX
timestamp here, so we need to use `UNIX_TIMESTAMP()` instead.
2024-03-18 10:22:35 +01:00
Julian Brost
653f356123 Increase database schema version
The removal of the `NOT NULL` constraint on `customvar_flat`.`flat_value` makes
the schema upgrade a hard requirement for 1.1.1.
2023-08-07 13:09:01 +02:00
Julian Brost
6068ab78d0 Schema: change sort order of history event type enum
This improves the resulting sort order when `ORDER BY event_time, event_type`
is used. `state_change` comes first as it can cause many of the other events
like trigger downtimes, remove acknowledgements and send notifications.
Similarly, `notification` comes last as any other event can result in a
notification. This will result in history events for scenarios like state
changes, triggers downtime, sends downtime start notification being sorted in
that order.

Apart from that, end events sort before the corresponding start events as any
ack/comment/downtime/flapping period should last for more than a millisecond,
therefore if there should be two events within the same millisecond, the end
event corresponds to the older period and is sorted first.
2023-08-04 15:56:53 +02:00
Johannes Meyer
f46193a372 schema/mysql: Add missing indices to hostgroup and servicegroup
fixes #615
2023-08-01 16:36:31 +02:00
Johannes Meyer
c5272605c3 schema/mysql: Add new index for customvar_flat 2023-08-01 15:36:34 +02:00
Yonas Habteab
fa0a712bac Flatten empty custom vars of type array & map correctly 2023-06-29 13:43:33 +02:00
Alexander A. Klimov
cde27fd608 schema: notification: enlarge name and name_ci 255 -> 767 2023-05-23 15:36:17 +02:00
Yonas Habteab
81e313e2db Schema: Include environment_id as part of the history retention indices
When UPSERT and DELETE statements are executed at the same time, a
deadlock can occur if both want to get an exclusive lock on one of the
PRIMARY KEY index pages. This happens with DELETE statements when there
is no suitable index for the columns used in the WHERE clause, which is
true for our history retention queries since commit eccac78. This PR
fixes the problem by adding a suitable index for the columns used in
these queries.
2022-06-29 10:05:08 +02:00
Yonas Habteab
fa6c23d634 Make json keys and DB columns consistent 2022-06-24 16:00:11 +02:00
Eric Lippmann
ea6646937d Add _name suffix to columns referring to name 2022-05-31 15:15:29 +02:00
Julian Brost
5f5b3fb919
Merge pull request #482 from Icinga/feature/parameter-delimiters-check-execution-6277
Add CommandArgument#Separator
2022-05-23 13:23:51 +02:00
Alexander A. Klimov
1cacfbe7ba Add CommandArgument#Separator 2022-05-16 17:26:25 +02:00
Julian Brost
b81392857a SLA reporting: add SQL stored function to calculate SLA value 2022-05-13 12:04:47 +02:00
Julian Brost
7cd6fd98ce SLA reporting: SQL schema 2022-05-11 11:44:45 +02:00
Eric Lippmann
65eece39f1 Schema: Make custom variable names case insensitive
To make custom variable searches case-insensitive by default.
2022-05-09 11:35:38 +02:00
Yonas Habteab
8b5edd7802 Schema: Adjust primary key irregularities of icon_image, notes_url & action_url tables 2022-04-08 17:03:32 +02:00
Eric Lippmann
01d9023098 Add indices for history retention 2022-03-22 15:55:04 +01:00
Julian Brost
dfdced9a3b
Merge pull request #441 from Icinga/bugfix/typo
Fix typo
2022-03-07 15:34:20 +01:00
Alexander A. Klimov
f5733526d0 Fix typo 2022-02-17 13:58:35 +01:00
Alexander A. Klimov
879b683041 Add previous_soft_state to host_state and service_state
refs #437
2022-02-17 13:48:17 +01:00
Alexander A. Klimov
3213d18249 Schema: make notification_history#text longtext 2022-01-28 11:51:58 +01:00
Eric Lippmann
eb468af318
Merge pull request #397 from Icinga/introduce-more-indexes
Add more MySQL indexes
2021-11-12 18:19:42 +01:00
Eric Lippmann
e40d3d3828 Insert schema version last 2021-11-12 17:39:32 +01:00
Yonas Habteab
611b68ca5a MySQL: Add more indexes
Co-authored-by: Eric Lippmann <eric.lippmann@icinga.com>
2021-11-12 12:53:11 +01:00
Eric Lippmann
dae0bfb252 Set values for new host_id and downtime duration columns 2021-11-12 11:28:02 +01:00
Yonas Habteab
54c563d1c7 Add service_state.host_id column 2021-11-12 11:28:02 +01:00
Yonas Habteab
6faa84d94a Downtime: Add duration & scheduled_duration columns 2021-11-12 11:28:02 +01:00
Noah Hilverling
8e8426da25 Schema: Fix index typos introduced by #385 2021-11-12 10:51:52 +01:00
Noah Hilverling
c19cfdf406 Schema: Prefix command_id with command type (check, event, notification)
Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
2021-11-09 15:11:09 +01:00
Julian Brost
6cf9266655 Update schema comments to match new use of environments
There was a change to how environments work in icinga2 that affects how many
IDs are structured: https://github.com/Icinga/icinga2/pull/9036
2021-11-03 15:47:38 +01:00
Alexander A. Klimov
d903d05c82 Make History*#Id UUID -> SHA1 2021-11-03 12:15:25 +01:00
Alexander A. Klimov
52ae34a6f8 Make {NotificationHistory,StateHistory}#Id UUID -> SHA1 2021-11-03 12:15:25 +01: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
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
Johannes Meyer
830dc20976 mysql.schema.sql: Add missing indices to *_customvar tables 2021-10-05 15:03:58 +02:00
Alexander A. Klimov
d8b3f75778 Schema: s/mediumtext/longtext/
... to make MySQL storage capabilities of likely large text columns
more similar (16MB -> 4GB) to (upcoming) Postgres ones (unlimited)
and not to have to pre-truncate anything.

refs #260
2021-09-28 11:13:51 +02:00
Alexander A. Klimov
82d8f830af Include CheckResult#scheduling_source in state and history
refs #160
2021-09-22 17:30:13 +02:00
Julian Brost
af61846114
Merge pull request #344 from Icinga/feature/downtime-column-comments
Schema: Add description to downtime columns 'triggered_by_id' and 'parent_id'
2021-09-03 16:20:59 +02:00
Noah Hilverling
b9ec99185a Schema: Add description to downtime columns 'triggered_by_id' and 'parent_id' 2021-08-12 14:41:15 +02:00
Alexander A. Klimov
825dcbc817 Introduce downtime#scheduled_by 2021-08-09 20:12:10 +02:00
Eric Lippmann
783b3a6bfe
Merge pull request #323 from Icinga/feature/downtime-parent-downtime-id
Downtime: Add parent_id
2021-08-09 13:43:16 +02:00
Eric Lippmann
7e237c6aef
Merge pull request #329 from Icinga/schema-mode
Use SET SESSION for schema modes
2021-08-09 10:29:10 +02:00
Alexander A. Klimov
9fdf40bd88 Enlarge {comment,downtime}#name 255 -> 548
I.e. large enough for "HOST!SERVICE!UUID".

refs #273
2021-08-05 16:36:27 +02:00
Eric Lippmann
77c2365e6f Use SET SESSION for schema modes
As of version 8, MySQL is stricter when it comes to setting system
and session variables and requires that the user importing our schema
be granted the SESSION_VARIABLES_ADMIN permission. Although the session
scope is already the default, we will now use SET SESSION for the modes
in our scheme for the sake of clarity.
2021-08-05 09:49:53 +02:00
Alexander A. Klimov
1617a661d3 Clarify why acknowledgement_history#comment is NULLable
refs #305
2021-08-04 14:19:02 +02:00
Alexander A. Klimov
194c84ad3b Allow acknowledgement_history#{author,is_sticky,is_persistent} being NULL
... for the case an ack_set event happened before Icinga DB history recording.

refs #305
2021-08-04 12:21:16 +02:00