Commit graph

26 commits

Author SHA1 Message Date
Eric Lippmann
957e610508 Replace utils.Fatal() with utils.PrintErrorThenExit() 2024-05-23 09:46:25 +02:00
Eric Lippmann
3569b35294 Fix types#UnixMilli.UnmarshalText() crashing on empty strings 2024-05-22 11:51:22 +02:00
Eric Lippmann
1d9dc74391 Add utils#IsUnixAddr() 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
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
Julian Brost
9c2dcd2502 Run go fmt ./...
Looks like newer Go version have a different opinion on how indentation in
comments should look like. Adapt existing comments to make the GitHub Actions
happy.
2023-08-04 12:50:45 +02:00
Julian Brost
71c1d2fa4d Migration: refactor output/processing of converted entities
This commit simplifies the `icingaDbOutputStage` type to contain only one
entity slice to be insert/upsert. This allows to simplify the handling in
`migrateOneType()` by removing nested loops.

Additionally, a bit of code inside that function is outsourced into a new
`utils.ChanFromSlice()` function. This makes the body of the loop over the
insert/upsert operation (the loop using the `op` variable) simple enough so
that it can just be unrolled which saves the inline struct and slice definition
for that loop.
2023-07-31 11:10:42 +02:00
Alexander A. Klimov
ab14413393 Log UNIX socket address w/o port number
E.g. not
Connecting to database at '/var/lib/mysql/mysql.sock:0'
Connecting to Redis at '/run/icingadb-redis/icingadb-redis-server.sock:6380'
2022-11-09 11:03:50 +01:00
Alexander A. Klimov
f843b06288 Do x.UnixMilli(), not utils.UnixMilli(x)
and remove redundant utils.UnixMilli().
2022-04-14 12:59:37 +02:00
Alexander A. Klimov
2bc92cbab7 UnixMilli(x): don't overflow on 4/11/2262 (UTC)
but on 8/17/292278994 by not converting x into int64 ns and those to ms.
2022-04-14 12:59:37 +02:00
Alexander A. Klimov
ad895b560d Handle Postgres-specific errors
refs #136
2022-03-09 18:49:45 +01:00
Noah Hilverling
12b99eda89 Make sure Redis connection pool is large enough
The default Redis PoolSize is 10 * CPU, which isn't enough to run Icinga DB on machines with only 1 CPU.
Most of our open connections come from blocking XREADs. (e.g. Heartbeat, Runtime, Overdue, History)
2021-12-09 15:55:24 +01: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
7d59a98f90 Add missing doc in utils 2021-08-09 10:30:53 +02:00
Alexander A. Klimov
41e473b244 Remove unused functions 2021-08-09 10:29:47 +02:00
Eric Lippmann
e12425d8dc Wrap errors 2021-06-21 12:13:24 +02:00
Alexander A. Klimov
c25c47ad72 Compare errors smartly, i.e. unwrap them first 2021-05-31 16:52:47 +02:00
Alexander A. Klimov
05c1361f1a Introduce utils.Ellipsize() 2021-05-19 11:55:17 +02:00
Alexander A. Klimov
4dc935534c Fix missing import 2021-04-19 16:48:02 +02:00
Eric Lippmann
0c8a9139b5 Merge pull request #28 from lippserd/bugfix/delta-race
Delta#start(): avoid a race across maps by using a mutex
2021-04-19 16:20:42 +02:00
Alexander A. Klimov
bf1a77a67c Drop utils.SyncMap*() 2021-04-12 17:41:18 +02:00
Alexander A. Klimov
9aa1070db0 Introduce contracts.TableNamer 2021-04-12 13:28:03 +02:00
Eric Lippmann
03e6e9d0f3 Add utils
This commit introduces various utility functions.
2021-03-03 15:20:27 +01:00