Commit graph

1972 commits

Author SHA1 Message Date
Alexander A. Klimov
41e473b244 Remove unused functions 2021-08-09 10:29:47 +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
Eric Lippmann
a497004a08
Merge pull request #339 from Icinga/bugfix/comment-and-downtime-name-columns-too-small-273
Enlarge {comment,downtime}#name 255 -> 548
2021-08-09 10:28:43 +02:00
Eric Lippmann
868d46219a
Merge pull request #340 from Icinga/retry-badconn
Also retry driver.ErrBadConn
2021-08-09 10:27:03 +02:00
Eric Lippmann
e1d25ba54a
Merge pull request #341 from Icinga/log-mysql-driver-errors
Log MySQL driver errors at the debug level instead of discarding them
2021-08-09 10:26:49 +02:00
Alexander A. Klimov
46da390499 Validate specified config file only once
... after processed --version to allow --version w/o config file.

refs #335
2021-08-06 12:40:15 +02:00
Alexander A. Klimov
31fd1963f2 Support --version
refs #335
2021-08-06 12:40:15 +02:00
Eric Lippmann
ebd3f10d69 Log MySQL driver errors at the debug level instead of discarding them
The MySQL driver logs something like unexpected EOF, busy buffer,
broken pipe, bad connection, invalid connection etc. in the event
of an error. Most of these are retryable and are handled either by
the MySQL driver or our retry logic. Previously these messages
were discarded, but since they can be useful when debugging
connectivity issues, we'll now log them with the debug severity as
otherwise they would add too much noise to the logs where you might
see error messages with no actual effect.
2021-08-06 10:44:50 +02:00
Eric Lippmann
9b5e016e57 Also retry driver.ErrBadConn
ErrBadConn is returned by a driver to signal that a driver.Conn is
in a bad state. We have to retry with these errors as well.
2021-08-06 10:02:14 +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
Eric Lippmann
b5b169aea8
Merge pull request #312 from Icinga/bulk-statement-size
Bulk statement size
2021-08-05 00:40:25 +02:00
Eric Lippmann
31be9c5911
Merge pull request #328 from Icinga/dependabot/go_modules/github.com/go-redis/redis/v8-8.11.1
Bump github.com/go-redis/redis/v8 from 8.11.0 to 8.11.1
2021-08-05 00:40:04 +02:00
Alexander Aleksandrovič Klimov
8f47bf47ca
Merge pull request #333 from Icinga/bugfix/unack-crash-305
Allow acknowledgement_history#{author,is_sticky,is_persistent} being NULL
2021-08-04 15:26:10 +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
Alexander Aleksandrovič Klimov
bca8e49447
Merge pull request #326 from Icinga/bugfix/use-append-x-y-only-to-modify-x-in-place-324
Don't append(x,y) if x is not to be modified
2021-08-04 12:07:39 +02:00
Alexander A. Klimov
ec37415261 AcknowledgementHistory#Author: make missing value NULL, not ""
refs #305
2021-08-04 12:02:08 +02:00
Eric Lippmann
bbba443529 Reduce the size of bulk statements and make the size configurable
Reduce the size of the bulk create, update, and delete statements to
also reduce query execution time so that the database server
can better execute statements in parallel.
2021-08-04 00:14:31 +02:00
Alexander A. Klimov
f06bad5f23 Don't append(x,y) if x is not to be modified
... as append(x,y) would modify x.

refs #324
2021-08-03 18:59:40 +02:00
Alexander Aleksandrovič Klimov
261c5aab8d
Merge pull request #322 from Icinga/feature/icingadb-last_comment_id
Icinga DB: introduce Checkable#last_comment_id
2021-08-03 16:29:40 +02:00
Julian Brost
2b32904572
Merge pull request #325 from Icinga/state-stream
Stream state updates from icinga:runtime:state
2021-08-03 16:02:15 +02:00
Eric Lippmann
a936d26c75 Get the last IDs of the runtime update streams before starting anything else
Otherwise updates may be lost.
2021-08-03 14:06:55 +02:00
Eric Lippmann
e35a1609fc Stream state updates from icinga:runtime:state
Icinga now sends runtime updates in two separate channels,
icinga:runtime for config updates and icinga:runtime:state for
state updates. With this change, Icinga DB reads from these two
streams. This is a preparation so that state updates can be
streamed directly after a (re)start of Icinga or Icinga DB without
waiting for the config sync, as it is currently done.
2021-08-03 14:06:55 +02:00
dependabot[bot]
5d30de137a
Bump github.com/go-redis/redis/v8 from 8.11.0 to 8.11.1
Bumps [github.com/go-redis/redis/v8](https://github.com/go-redis/redis) from 8.11.0 to 8.11.1.
- [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.0...v8.11.1)

---
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-08-02 10:01:36 +00:00
Alexander A. Klimov
7346edb836 Icinga DB: introduce Checkable#last_comment_id 2021-07-26 18:10:28 +02:00
Noah Hilverling
9f6c73ca56 Downtime: Add parent_id 2021-07-23 13:54:39 +02:00
Eric Lippmann
ab4caa32a2
Merge pull request #319 from Icinga/heartbeat
Pointer receivers, Cond usage, pass ctx and Godoc for Heartbeat
2021-07-21 19:06:13 +02:00
Eric Lippmann
725e70f0b9 Pointer receivers, Cond usage, pass ctx and Godoc for Heartbeat
Heartbeat now uses pointer receivers for its methods because
some methods actually change the heartbeat values.
The context is no longer stored in the structure,
but passed to the controller loop.
The beat and the lost channels are replaced by Cond and
the last heartbeat is stored independently to not be affected by
a slow HA receiver. If the database connections are occupied by
the config, HA cannot update the instance and does not read from
the beat channel in time.
In addition, heartbeat errors are no longer swallowed,
but handled in HA.
2021-07-20 10:17:05 +02:00
Eric Lippmann
ea19c42f9b
Merge pull request #320 from Icinga/dependabot/go_modules/github.com/google/uuid-1.3.0
Bump github.com/google/uuid from 1.2.0 to 1.3.0
2021-07-20 09:23:43 +02:00
dependabot[bot]
4a308d82e8
Bump github.com/google/uuid from 1.2.0 to 1.3.0
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/google/uuid/releases)
- [Commits](https://github.com/google/uuid/compare/v1.2.0...v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/google/uuid
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-19 10:01:32 +00:00
Eric Lippmann
b7ecfb9df2 Do not store ctx inside Cond and add Godoc 2021-07-15 14:06:21 +02:00
Eric Lippmann
cf3a13d3f5
Merge pull request #295 from Icinga/feature/chk-db-schema
Assert the database schema of the expected version being present
2021-07-13 15:18:17 +02:00
Eric Lippmann
320fcd84bb
Merge pull request #308 from Icinga/feature/normalized_performance_data
Introduce *_state#normalized_performance_data
2021-07-13 15:16:38 +02:00
Eric Lippmann
2eb914a48c
Merge pull request #303 from Icinga/bugfix/cfg-segv
Fix SEGV due to empty config
2021-07-08 10:50:58 +02:00
Alexander A. Klimov
9bf1512e06 Introduce *_state#normalized_performance_data 2021-07-07 19:02:55 +02:00
Eric Lippmann
7bf7501d5a
Merge pull request #307 from Icinga/dependabot/go_modules/github.com/go-redis/redis/v8-8.11.0
Bump github.com/go-redis/redis/v8 from 8.10.0 to 8.11.0
2021-07-06 20:15:30 +02:00
Alexander A. Klimov
6a17911e6b Assert the database schema of the expected version being present 2021-07-06 19:00:20 +02:00
Alexander A. Klimov
f47b6e7657 Fix SEGV due to empty config 2021-07-06 18:42:40 +02:00
Eric Lippmann
2d0d9d26a9
Merge pull request #304 from Icinga/bulk-upsert
Activate and use bulk upsert
2021-07-05 19:15:08 +02:00
Eric Lippmann
788c3db4aa
Merge pull request #306 from Icinga/dependabot/go_modules/go.uber.org/zap-1.18.1
Bump go.uber.org/zap from 1.17.0 to 1.18.1
2021-07-05 19:14:51 +02:00
dependabot[bot]
a86eb0e6cb
Bump github.com/go-redis/redis/v8 from 8.10.0 to 8.11.0
Bumps [github.com/go-redis/redis/v8](https://github.com/go-redis/redis) from 8.10.0 to 8.11.0.
- [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.10.0...v8.11.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-05 10:01:34 +00:00
dependabot[bot]
73759120b7
Bump go.uber.org/zap from 1.17.0 to 1.18.1
Bumps [go.uber.org/zap](https://github.com/uber-go/zap) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/uber-go/zap/releases)
- [Changelog](https://github.com/uber-go/zap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/uber-go/zap/compare/v1.17.0...v1.18.1)

---
updated-dependencies:
- dependency-name: go.uber.org/zap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-05 10:01:27 +00:00
Eric Lippmann
43624ecebe Use bulk upsert for bulk updates in sync 2021-07-05 08:51:32 +02:00
Eric Lippmann
f5777f1055 Use bulk upsert in runtime updates 2021-07-01 11:20:43 +02:00
Eric Lippmann
73865f819a Activate bulk upsert
sqlx >= v1.3.4 supports `VALUES(col_name)` to refer to column values.
2021-07-01 11:15:49 +02:00
Eric Lippmann
5cba0f9e22 Return number of placeholders 2021-07-01 11:13:17 +02:00
Eric Lippmann
3df8323353
Merge pull request #248 from Icinga/fix/out-perf-mediumtext
Change output, long_output and performance_data columns to mediumtext
2021-06-29 16:58:39 +02:00
Ravi Kumar Kempapura Srinivasa
6079665de9 output, long_output and performance_data columns modified to mediumtext
mediumtext is a tradeoff between text and longtext; text being too short and longtext being too big.
2021-06-24 13:49:26 +02:00
Eric Lippmann
f8315deb9c
Merge pull request #300 from Icinga/driver-context
Driver context
2021-06-23 09:03:20 +02:00