15 Commits

Author SHA1 Message Date
Kegan Dougal
b2c26b7e93 Redact events in the DB on m.room.redaction
Fixes #279
2023-08-31 17:06:44 +01:00
David Robertson
1ba3bc268c
Clean up integration test 2023-06-07 13:58:44 +01:00
David Robertson
69689192c6
Integration test?? 2023-06-06 20:55:09 +01:00
Kegan Dougal
be8543a21a add extensions for typing and receipts; bugfixes and additional perf improvements
Features:
 - Add `typing` extension.
 - Add `receipts` extension.
 - Add comprehensive prometheus `/metrics` activated via `SYNCV3_PROM`.
 - Add `SYNCV3_PPROF` support.
 - Add `by_notification_level` sort order.
 - Add `include_old_rooms` support.
 - Add support for `$ME` and `$LAZY`.
 - Add correct filtering when `*,*` is used as `required_state`.
 - Add `num_live` to each room response to indicate how many timeline entries are live.

Bug fixes:
 - Use a stricter comparison function on ranges: fixes an issue whereby UTs fail on go1.19 due to change in sorting algorithm.
 - Send back an `errcode` on HTTP errors (e.g expired sessions).
 - Remove `unsigned.txn_id` on insertion into the DB. Otherwise other users would see other users txn IDs :(
 - Improve range delta algorithm: previously it didn't handle cases like `[0,20] -> [20,30]` and would panic.
 - Send HTTP 400 for invalid range requests.
 - Don't publish no-op unread counts which just adds extra noise.
 - Fix leaking DB connections which could eventually consume all available connections.
 - Ensure we always unblock WaitUntilInitialSync even on invalid access tokens. Other code relies on WaitUntilInitialSync() actually returning at _some_ point e.g on startup we have N workers which bound the number of concurrent pollers made at any one time, we need to not just hog a worker forever.

Improvements:
 - Greatly improve startup times of sync3 handlers by improving `JoinedRoomsTracker`: a modest amount of data would take ~28s to create the handler, now it takes 4s.
 - Massively improve initial initial v3 sync times, by refactoring `JoinedRoomsTracker`, from ~47s to <1s.
 - Add `SlidingSyncUntil...` in tests to reduce races.
 - Tweak the API shape of JoinedUsersForRoom to reduce state block processing time for large rooms from 63s to 39s.
 - Add trace task for initial syncs.
 - Include the proxy version in UA strings.
 - HTTP errors now wait 1s before returning to stop clients tight-looping on error.
 - Pending event buffer is now 2000.
 - Index the room ID first to cull the most events when returning timeline entries. Speeds up `SelectLatestEventsBetween` by a factor of 8.
 - Remove cancelled `m.room_key_requests` from the to-device inbox. Cuts down the amount of events in the inbox by ~94% for very large (20k+) inboxes, ~50% for moderate sized (200 events) inboxes. Adds book-keeping to remember the unacked to-device position for each client.
2022-12-14 18:53:55 +00:00
Kegan Dougal
54e1cfbb0e bugfix: ensure newly joined live-stream rooms don't cause 500s
This was caused by the GlobalCache not having a metadata entry for
the new room, which in some cases prevented a stub from being made.

With regression test.
2022-08-10 19:48:03 +01:00
Kegan Dougal
1a55076478 Add NewJoinEvent shorthand for tests 2022-07-12 15:12:02 +01:00
Kegan Dougal
300f1e16c3 Add benchmark for number of rooms on a user's account 2022-04-01 17:23:48 +01:00
Kegan Dougal
c15c3f290e Integration tests for transaction IDs
Also standardise testutils.NewEvent to match testutils.NewStateEvent
to allow With... modifiers.
2022-03-28 15:52:25 +01:00
Kegan Dougal
3ecef2062e feature: Support account_data extension
Along with a battery of tests to make sure we give account data only
for rooms being tracked in the sliding lists, unless it's global in
which case we just send it on.
2022-03-24 19:38:55 +00:00
Kegan Dougal
0b58b0f62b Store membership changes in events table 2021-10-26 18:39:22 +01:00
Kegan Dougal
eaea3402a2 Use gmsl.Timestamp in more places 2021-10-26 10:01:45 +01:00
Kegan Dougal
52da56c70d Remove ConnStateStore and use Global/UserCache exclusively
Add a `LoadJoinedRoomsOverride` to allow tests to override
and bypass DB checks. We need them in the cache in order to
synchronise loading connection state with live updates to
ensure we process events exactly once.
2021-10-11 18:09:29 +01:00
Kegan Dougal
6a851c57e9 Make each generated event ID unique for each test 2021-08-20 16:38:35 +01:00
Kegan Dougal
2ffa81ede2 Don't race when generating new event IDs in tests 2021-08-20 16:32:45 +01:00
Kegan Dougal
65cbdb07c8 Add type|state_key cols to events table; refactor select in
- Add `verifyAll` flag to assert if all events should be in the SELECT result
- Factor out `testutils.NewStateEvent`
2021-08-20 15:56:17 +01:00