Commit graph

603 commits

Author SHA1 Message Date
Alexander A. Klimov
47d0cbc0d9 Test types.NotificationType#Value() 2024-09-05 16:28:00 +02:00
Alexander A. Klimov
58f881e7b0 Test types.NotificationType#UnmarshalText() 2024-09-05 16:21:04 +02:00
Julian Brost
277a61d30e
Merge pull request #777 from Icinga/test-icingaredis
Test icingaredis.CreateEntities()
2024-08-09 17:01:28 +02:00
Alexander A. Klimov
7f20cf2e33 Test icingaredis.CreateEntities() 2024-08-05 12:45:32 +02:00
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
Eric Lippmann
be4b450f5c Remove library code 2024-05-24 09:56:35 +02:00
Eric Lippmann
7c068d4adf Use icinga-go-library 2024-05-24 09:56:28 +02:00
Yonas Habteab
a016cc22ff Allow to dynamically define type constraint name 2024-05-23 12:42:28 +02:00
Eric Lippmann
cf90a395ac database: Introduce ColumnMap
`ColumnMap` provides a cached mapping of structs exported fields to
their database column names. By default, all exported struct fields are
mapped to their database column names using snake case notation. The `-`
(hyphen) directive for the db tag can be used to exclude certain fields.
Since `ColumnMap` uses cache, the returned slice MUST NOT be modified
directly.
2024-05-23 12:42:28 +02:00
Eric Lippmann
a73940e60a Introduce GetAddr() for database#DB and redis#Client 2024-05-23 12:42:28 +02:00
Eric Lippmann
b396a365e0 config#FromYAMLFile(): Parse result into value pointed to by the passed argument 2024-05-23 12:42:28 +02:00
Eric Lippmann
9f8354466a config#ParseFlags(): Parse result into value pointed to by the passed argument 2024-05-23 10:08:48 +02:00
Eric Lippmann
957e610508 Replace utils.Fatal() with utils.PrintErrorThenExit() 2024-05-23 09:46:25 +02:00
Eric Lippmann
1e221e4735 Refine types#UnixMilli tests 2024-05-22 11:51:22 +02:00
Eric Lippmann
5525c2085b types#UnixMilli.Scan(): Support uint64 2024-05-22 11:51:22 +02:00
Eric Lippmann
7f43a81369 types#UnixMilli.Scan(): Support []byte 2024-05-22 11:51:22 +02:00
Eric Lippmann
3569b35294 Fix types#UnixMilli.UnmarshalText() crashing on empty strings 2024-05-22 11:51:22 +02:00
Eric Lippmann
f3eeb61b54 Introduce contracts#SafeInit() 2024-05-22 11:51:22 +02:00
Eric Lippmann
647220ca8c Decouple structify from contracts 2024-05-22 11:51:22 +02:00
Eric Lippmann
7b73b8788a Introduce logging#NewLoggingFromConfig() 2024-05-22 11:51:22 +02:00
Eric Lippmann
43115e7c6c Don't set default port in redis 2024-05-22 11:51:22 +02:00
Eric Lippmann
c070615e64 Move Redis related code to redis 2024-05-22 11:51:22 +02:00
Eric Lippmann
3072a10c7f Move internal/config#FromYAMLFile() to config#FromYAMLFile() 2024-05-22 11:51:22 +02:00
Eric Lippmann
e5a830cabc Move internal/config#ParseFlags() to config#ParseFlags() 2024-05-22 11:51:22 +02:00
Eric Lippmann
8beb8616ad Move database related code from internal to database 2024-05-22 11:51:22 +02:00
Eric Lippmann
c41cbf260e Move TLS config options to config#TLS 2024-05-22 11:51:21 +02:00
Eric Lippmann
563045cc5a Add logging#Config 2024-05-22 11:51:21 +02:00
Eric Lippmann
1d9dc74391 Add utils#IsUnixAddr() 2024-05-22 11:51:21 +02:00
Eric Lippmann
1ddaa70aab Move special types to icingadb/types 2024-05-22 11:51:21 +02:00
Eric Lippmann
f54a142815 Move icingadb#DB to database#DB 2024-05-22 11:51:21 +02:00
Eric Lippmann
aa3c00893f Move contracts#Waiter{,Func} to com#Waiter{,Func} 2024-05-22 11:51:21 +02:00
Eric Lippmann
a62c7e7c53 Move com#SplitOnDupId() to database#SplitOnDupId() 2024-05-22 11:51:21 +02:00
Eric Lippmann
9f432e49a5 Make com#CopyFirst() generic 2024-05-22 11:51:21 +02:00
Eric Lippmann
490c18fd5f Move database#DB.CheckSchema() to icingadb#CheckSchema() 2024-05-22 11:51:21 +02:00
Eric Lippmann
aec0bdada4 Introduce icingadb#RetryConnectorCallbacks
This is a preparation to decouple general database code from Icinga DB
specific code, i.e. `icingaredis/telemetry`.
2024-05-22 11:51:21 +02:00
Eric Lippmann
1e32978651 Use google/go-cmp to determine equality of checksums
Otherwise we would have to move the `Equaler` interface to the
`types` package, which is pretty useless for a single use case.
2024-05-22 11:51:21 +02:00
Eric Lippmann
77ccdfc303 Move type related utility functions from internal to types 2024-05-22 11:51:21 +02:00
Eric Lippmann
2f3bf491d7 Move utils#Name() to types#Name() 2024-05-22 11:51:21 +02:00
Eric Lippmann
b2a43fd47d types#Binary: Assert fmt.Stringer interface compliance
This prevents import cycles because the `database` package uses the
`types` packages.
2024-05-22 11:51:21 +02:00
Eric Lippmann
ed69f42462 Move utils#TableName() to database#TableName() 2024-05-22 11:51:21 +02:00
Eric Lippmann
e2b4f0297f Introduce strcase for converting string cases 2024-05-22 11:51:21 +02:00
Eric Lippmann
75501e11f8 Move database related contracts to database/contracts 2024-05-22 11:51:21 +02:00
Eric Lippmann
43685e4131 Move internal#CantPerformQuery() to database#CantPerformQuery() 2024-05-22 11:51:21 +02:00
Eric Lippmann
7b537661ee Move icingadb/objectpacker to objectpacker 2024-05-22 11:51:21 +02:00
Eric Lippmann
9e70aa808c Move config to internal/config 2024-05-22 11:51:21 +02:00
Eric Lippmann
5029e328c8 Unify notation of n * time.Duration 2024-04-11 13:01:31 +02:00
Julian Brost
889a153738
Merge pull request #740 from Icinga/retry-schema-check
icingadb.DB: Retry Schema Checks
2024-04-11 11:58:29 +02:00
Alvar Penning
fab2765733
icingadb.DB: Retry Schema Checks
During testing, I just encountered a race condition where my Galera
cluster was not yet ready, causing the initial schema check to fail.

```
2024-04-11T08:13:40.401Z        INFO    icingadb        Starting Icinga DB daemon (1.1.1)
2024-04-11T08:13:40.401Z        INFO    icingadb        Connecting to database at 'mysql:3306'
2024-04-11T08:13:40.404Z        FATAL   icingadb        Error 1047 (08S01): WSREP has not yet prepared node for application use
can't check database schema version
github.com/icinga/icingadb/pkg/icingadb.(*DB).CheckSchema
        /go/src/github.com/Icinga/icingadb/pkg/icingadb/db.go:115
main.run
        /go/src/github.com/Icinga/icingadb/cmd/icingadb/main.go:74
main.main
        /go/src/github.com/Icinga/icingadb/cmd/icingadb/main.go:37
runtime.main
        /usr/local/go/src/runtime/proc.go:271
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1695
exit status 1
```

This change now also retries the initial cluster check.

References #698.
2024-04-11 11:14:15 +02:00
Alvar Penning
360e7b7071
icingadb: Remove shouldRetry
The additional check against a driver.ErrBadConn is now also part of
retry.Retryable. Thus, it can be dropped.
2024-04-11 11:05:06 +02:00
Yonas Habteab
1b380bb76e Retry io.EOF error 2024-04-11 10:09:24 +02:00