31 Commits

Author SHA1 Message Date
Kegan Dougal
3fc49bd4ea Migration review comments 2024-05-20 08:37:09 +01:00
Kegan Dougal
af1f34861e Ensure txns are closed so we can wipe the db for other tests 2024-05-17 16:09:02 +01:00
Kegan Dougal
5028f93f83 If there's no updates, don't insert anything 2024-05-17 15:37:45 +01:00
Kegan Dougal
fcd9b490f9 Debug logging 2024-05-17 15:20:18 +01:00
Kegan Dougal
b6f2f9d273 Use a CURSOR 2024-05-17 14:48:08 +01:00
Kegan Dougal
b383ed0d82 Add migrations and refactor internal structs 2024-05-17 13:45:14 +01:00
Kegan Dougal
03f62871ef Review comments 2023-11-09 10:29:26 +00:00
Kegan Dougal
4de37c51f9 Migrate stuck invites
With tests.
2023-11-08 18:26:35 +00:00
David Robertson
3a9cbaae8d
Fixup test log line 2023-10-19 18:18:55 +01:00
David Robertson
e5b1f13f30
Fix typos 2023-10-19 18:05:34 +01:00
David Robertson
a393f3ff14
Test the migration 2023-10-19 18:04:16 +01:00
David Robertson
b4f30f508b
Add migration to cleanup dead invites
Fixes #350.
2023-10-19 16:05:33 +01:00
David Robertson
e06a5437a7
Ditch COMMENT ON 2023-09-20 12:45:41 +01:00
David Robertson
16796db033
Add syncv3_events.missing_previous 2023-09-13 19:17:53 +01:00
David Robertson
6f3f556842
Revert "Add syncv3_events.missing_previous"
This reverts commit b8841008142c94498855a35a5ab477904f442b73.
2023-09-13 12:18:47 +01:00
David Robertson
b884100814
Add syncv3_events.missing_previous 2023-09-13 12:18:31 +01:00
David Robertson
6b92d62116
Improve logging
Co-authored-by: kegsay <kegan@matrix.org>
2023-08-23 11:46:20 +01:00
David Robertson
7cbefdfbbe
Write the migration in go instead
so we can have meaningful logging
2023-08-22 19:11:31 +01:00
David Robertson
68b5eb06bd
Goose runs its migration in a txn by default
According to https://github.com/pressly/goose#sql-migrations, anyway
2023-08-22 18:02:40 +01:00
David Robertson
7a70d4780d
Migration to clean up bogus rooms
These rooms have invalid state snapshots, leading to correctness
problems. The existence of such snapshots leaves us open to performance
problems due to gappy state updates.

We have prevented invalid state snapshots from being formed (#255, #266)
in the future. The remaining hole is to discard existing invalid
snapshots.

Closes #256.
2023-08-22 17:57:11 +01:00
Kegan Dougal
d1ca1762c1 More migration testing 2023-08-15 10:05:12 +01:00
Kegan Dougal
acf9748fe8 Remove nonsense tests now that JSONB is no more 2023-08-14 19:03:43 +01:00
Kegan Dougal
4714088231 device data: use CBOR instead of JSONB
Using JSONB columns adds too much DB load. Prefer a slightly
faster serialisation format instead, and use the old system of
handling BYTEA, which is about 2x faster.
```
BenchmarkSerialiseDeviceDataJSON-12    	    1770	    576646 ns/op	  426297 B/op	    6840 allocs/op
BenchmarkSerialiseDeviceDataCBOR-12    	    4635	    247509 ns/op	  253971 B/op	    4796 allocs/op
```
This was using a growing list of 1000 device list changes.
2023-08-14 18:53:45 +01:00
Till Faelligen
1e7fc8c537
Add missing rows.Close 2023-08-10 10:18:21 +02:00
Till Faelligen
7dd11ac186
Fix DB migration by pulling out everything from the DB first.. 2023-08-10 10:01:12 +02:00
Till Faelligen
478e8cd768
Add documentation about migrations 2023-08-03 10:57:16 +02:00
Till Faelligen
5cc66d80fe
More fault tolerance 2023-08-02 16:42:16 +02:00
Till Faelligen
182e010e67
Make JSONB migration happy 2023-08-02 16:38:56 +02:00
Till Faelligen
7b3ef7ee28
Migrate data to JSONB, update device data query 2023-08-02 14:00:42 +02:00
Till Faelligen
72ee3827ba
Alter table only if it exists 2023-07-28 15:17:07 +02:00
Till Faelligen
9b7d27dd87
Add initial support for database migrations 2023-07-28 15:10:15 +02:00