Commit graph

2294 commits

Author SHA1 Message Date
Till d96375ee06
Change detection of already executed migrations (#2665)
This changes the detection of already executed migrations for the
roomserver state block and keychange refactor. It now uses schema tables
provided by the database engine to check if the column was already
removed. We now also store the migration in the migrations table.

This should stop e.g. Postgres from logging errors like `ERROR: column
"event_nid" does not exist at character 8`.
2022-09-12 15:05:43 +01:00
Neil Alexander 41ff854a85
More writer fixes in the Sync API 2022-09-12 15:05:42 +01:00
Neil Alexander 3fa6af07e3
Use database writer in user API DeleteOldNotifications 2022-09-12 15:05:42 +01:00
Till 53692fcbb2
Update getting pushrules, add tests, tweak pushrules (#2705)
This PR
- adds tests for `evaluatePushrules`
- removes the need for the UserAPI on the `OutputStreamEventConsumer`
(for easier testing)
- adds a method to get the pushrules from the database
- adds a new default pushrule for `m.reaction` events (and some other
tweaks)
2022-09-12 15:05:42 +01:00
Till 6f662ec369
Fix issue with stale device lists (#2702)
We were only sending the last entry to the worker, so most likely missed
updates.
2022-09-12 15:05:42 +01:00
Till 35e83ad4a1
Fulltext implementation incl. config (#2480)
This adds the main component of the fulltext search.
This PR doesn't do anything yet, besides creating an empty fulltextindex
folder if enabled. Indexing events is done in a separate PR.
2022-09-12 15:05:40 +01:00
Neil Alexander 3a0f6e03d8
Use a single context instead 2022-09-12 15:05:07 +01:00
Neil Alexander 59991bc86a
Update state reset capture to Sentry 2022-09-12 15:05:07 +01:00
Till 6d09f3da51
Add HTTP status code to FederationClientError (#2699)
Also ensures we wait on more HTTP status codes.
2022-09-12 15:05:07 +01:00
Till 9d2d585c56
Avoid unneeded JSON operations (#2698)
We were `json.Unmarshal`ing the EDU and `json.Marshal`ing right before
sending the EDU to the stream. Those are now removed and the consumer
does `json.Unmarshal` once.
2022-09-12 15:05:07 +01:00
Till Faelligen af17cad587
Re-add waitTime if we're not blacklisted and no RetryAfter was
specified.
2022-09-12 15:05:06 +01:00
Till 64d8f7d8de
Add a SigningKeyUpdate producer (#2697)
This adds a new stream for signing key updates, this should ensure we
don't lose any updates over federation.
2022-09-12 15:05:06 +01:00
Till 2181f50490
Handle errors differently in the DeviceListUpdater (#2695)
`If a device list update goes missing, the server resyncs on the next
one` was failing because a previous test would receive a `waitTime` of
1h, resulting in the test timing out.
This now tries to handle the returned errors differently, e.g. by using
the default `waitTime` of 2s. Also doesn't try further users in the
list, if one of the errors would cause a longer `waitTime`.
2022-09-12 15:05:06 +01:00
Neil Alexander 8a2d1cc980
Update to matrix-org/gomatrixserverlib@637a173 2022-09-12 15:05:06 +01:00
Neil Alexander a266d4d972
Stronger default power levels 2022-09-12 15:05:06 +01:00
Neil Alexander d1209f5ef3
State resolution fixes in applyAndAuthEvent (update to matrix-org/gomatrixserverlib#336) 2022-09-12 15:05:06 +01:00
Neil Alexander 0db775e080
Tweak Sentry again 2022-09-12 15:05:05 +01:00
Neil Alexander 2823153f87
Set Sentry user where known 2022-09-12 15:05:05 +01:00
Neil Alexander e92d2985f0
Improve Sentry reporting 2022-09-12 15:05:05 +01:00
Neil Alexander 34acfc4fe3
Tweak logging for detected state resets 2022-09-12 15:05:05 +01:00
Neil Alexander 6d1c994991
State and auth tweaks (update to matrix-org/gomatrixserverlib#335) 2022-09-12 15:05:05 +01:00
Neil Alexander e4fee11ff9
Optimise resolve-state tool 2022-09-12 15:05:05 +01:00
Neil Alexander 9d0bc2946b
Move SetLatestEvents call 2022-09-12 15:05:04 +01:00
Till e811ceb13b
Only send (invite) events to the AS if it's interested in it (#2692)
This should hopefully fix #2691 (and maybe also #2690)
2022-09-12 15:05:04 +01:00
Neil Alexander 3d0c1656be
Update P2P demos 2022-09-12 15:05:01 +01:00
Neil Alexander 160a2ed67e
Version 0.9.6 (#2689)
Changelog and version bump.
2022-09-12 15:03:28 +01:00
Neil Alexander 3ea000947e
Configuration tweaks (#2567)
This makes the following changes:

* The various `Defaults` functions are now responsible for setting sane defaults if `generate` is specified, rather than hiding them in `generate-config`
* Some configuration options have been marked as `omitempty` so that they don't appear in generated configs unnecessarily (monolith-specific vs. polylith-specific options)
* A new option `-polylith` has been added to `generate-config` to create a config that makes sense for polylith deployments (i.e. including the internal/external API listeners and per-component database sections)
* A new option `-normalise` has been added to `generate-config` to take an existing file and add any missing options and/or defaults
2022-09-12 15:03:28 +01:00
Neil Alexander 638382a5b8
Refactor appservices component (#2687)
This PR refactors the app services component. It makes the following changes:

* Each appservice now gets its own NATS JetStream consumer
* The appservice database is now removed entirely, since we just use JetStream as a data source instead
* The entire component is now much simpler and we deleted lots of lines of code 💅

The result is that it should be much lighter and hopefully much more performant.
2022-09-12 15:03:28 +01:00
Neil Alexander d2feb57df6
Allow batching in JetStreamConsumer (#2686)
This allows us to receive more than one message from NATS at a time if we want.
2022-09-12 15:03:28 +01:00
Neil Alexander f2a6114279
Pinecone standalone refactoring (#2685)
This refactors the `dendrite-demo-pinecone` executable so that it:

1. Converts the old `.key` file into a standard `.pem` file
2. Allows passing in the `--config` option to supply a normal Dendrite configuration file, so that you can configure PostgreSQL instead of SQLite, appservices and all the other usual stuff
2022-09-12 15:03:28 +01:00
Neil Alexander 10f52376bd
Check for "creator" field in m.room.create during event auth (update to matrix-org/gomatrixserverlib@c71e518) 2022-09-12 15:03:27 +01:00
PiotrKozimor 0caa0adfa8
Index on syncapi_send_to_device table (#2684)
Introduced index improves select query performance. Example execution time of `selectSendToDeviceMessagesSQL` query dropped from 80 ms to 15 ms. No sytest modifications are required.

### Pull Request Checklist

* [x] I have added added tests for PR _or_ I have justified why this PR doesn't need tests.
* [x] Pull request includes a [sign off](https://github.com/matrix-org/dendrite/blob/main/docs/CONTRIBUTING.md#sign-off)

Signed-off-by: `Piotr Kozimor <p1996k@gmail.com>`
2022-09-12 15:03:27 +01:00
Till 31a27bdb14
Set the notification count when sending push notifications (#2683) 2022-09-12 15:03:27 +01:00
Till e5beaa010b
Use existing limit instead of default limit when lazy loading members (#2682)
This should fix an issue where we return less than the expected membership events, when doing an initial sync.
When doing an initial sync, the state limit is set to `math.MaxInt32`, while the default filter is set to 20.
2022-09-12 15:03:27 +01:00
Till ac09137409
Fix race condition on startup (#2679)
`SetupAndServeHTTP` would race in `configureHTTPErrors` and while configuring routes.
2022-09-12 15:03:18 +01:00
Neil Alexander dfa1f5d218
Fix the Cat Overflow bug (update to matrix-org/gomatrixserverlib@2020bdc) 2022-09-12 14:59:27 +01:00
Till Faelligen 9ffefa5fd6
Log roomserver error 2022-09-12 14:59:27 +01:00
Brian Meek d2877b034a
Race in keyserver intialization (#2619)
Signed-off-by: Brian Meek <brian@hntlabs.com>
2022-09-12 14:59:27 +01:00
Till Faelligen e7fbf06ec8
Default to limit of 20 state events 2022-09-12 14:59:26 +01:00
Neil Alexander 0fd37aac13
Enforce type, sender, state_key and room_id lengths using codepoints rather than bytes (update to matrix-org/gomatrixserverlib@5f66df0, matrix-org/matrix-spec#1001) 2022-09-12 14:59:26 +01:00
Neil Alexander dcec7783b5
Restrict username length properly (#2676)
This fixes #2674 by fixing the username check to comply with the [spec appendices](https://spec.matrix.org/v1.3/appendices/#user-identifiers):

> The length of a user ID, including the @ sigil and the domain, MUST NOT exceed 255 characters.
2022-09-12 14:59:26 +01:00
Neil Alexander 5c8fb18d06
Version 0.9.5 (#2673)
Changelog and version bump.
2022-09-12 14:59:26 +01:00
Till 1fbbb25ed9
SyncAPI tweaks/fixes (#2671)
- Reverts 9dc57122d9 as it was causing issues https://github.com/matrix-org/dendrite/issues/2660
- Updates the GMSL `DefaultStateFilter` to use a limit of 20 events
- Uses the timeline events to determine the new position instead of the state events
2022-09-12 14:59:26 +01:00
Neil Alexander 20fe89bfcb
Remove a couple unnecessary Sentry captures from backfill 2022-09-12 14:59:26 +01:00
Neil Alexander e1053689c0
Tweak logging and Sentry reporting for roomserver input 2022-09-12 14:59:25 +01:00
Neil Alexander 7e0faea586
Fix 500s on /state, /state_ids when state not known (#2672)
This was due to bad error bubbling.
2022-09-12 14:59:25 +01:00
Neil Alexander a2f729a74a
Allow un-rejecting events on reprocessing 2022-09-12 14:59:25 +01:00
0x1a8510f2 6690282468
Switch to stdlib atomic
No need for `go.uber.org/atomic` anymore
2022-09-12 14:59:25 +01:00
0x1a8510f2 d42653643f
Don't raise fd limit + simplify build constraints
See https://github.com/matrix-org/dendrite/issues/2564
2022-09-12 14:58:49 +01:00
0x1a8510f2 af036a7efa
Fix typo 2022-09-10 01:31:55 +01:00