aboutsummaryrefslogtreecommitdiff
path: root/roomserver
AgeCommit message (Collapse)Author
2022-10-07Fix issue with DMs shown as normal rooms (#2776)Till
Fixes #2121, test added in https://github.com/matrix-org/complement/pull/494
2022-10-07Revert "tDatabase transaction tweaks in roomserver"Neil Alexander
This reverts commit 8d8f4689a0c71f79051554e69fb9113592a4b2e4.
2022-10-07tDatabase transaction tweaks in roomserverNeil Alexander
2022-10-06Don't try to talk to ourselves when finding missing eventsNeil Alexander
2022-10-05Optimise `QuerySharedUsers` so that we can only work on local users (#2766)Neil Alexander
Otherwise the sync API key change consumer wastes a lot of time trying to wake up the notifiers for non-local users.
2022-10-05Add `RoomEventType` nats.Header to avoid unneeded unmarshalling (#2765)Till
2022-10-04Don't perform a federated join after invite if we are already joined to the ↵Neil Alexander
room (#2762) If we are already joined to the room then it shouldn't matter if you were invited or not, so this looks like a bug.
2022-09-26Remove `origin` field from PDUs (#2737)Neil Alexander
This nukes the `origin` field from PDUs as per matrix-org/matrix-spec#998, matrix-org/gomatrixserverlib#341.
2022-09-16Ensure that all state event IDs are included in the `added` section when ↵Neil Alexander
rewriting state (#2725) This should hopefully fix an entire class of problems where components downstream from the roomserver (i.e. the sync API) could just lose a whole bunch of state after a rewrite operation like a federated join. The root of the bug is that we set `RewritesState` in the output event which instructs downstream components to purge their copy of any room state, but then didn't send the entire state snapshot in `adds_state_event_ids` so the downstream state ends up being incomplete as a result.
2022-09-14Revert 482914aef4a7d637a8c468d46904fde9f478b5d1Neil Alexander
2022-09-13Use `AckNone` on the ephemeral room input consumerNeil Alexander
2022-09-13Tweak `LoadMembershipAtEvent` behaviour when state not known (#2716)Neil Alexander
Previously `LoadMembershipAtEvent` would fail if the state before one of the events was not known, i.e. because it was an outlier. This modifies it so that it gracefully handles not knowing the state and returns no memberships instead, so that history visibility doesn't freak out and kill `/sync` requests dead.
2022-09-13Always resolve state in `QueryStateAfterEvents`Neil Alexander
2022-09-13Check unique constraint errors when manually inserting migrations (#2712)Till
This should avoid unnecessary logging on startup if the migration (were we need `InsertMigration`) was already executed. This now checks for "unique constraint errors" for SQLite and Postgres and fails the startup process if the migration couldn't be manually inserted for some other reason.
2022-09-12Fix missing signature check on the `/get_missing_events` responseNeil Alexander
2022-09-09Fix transactions around assigning NIDsNeil Alexander
2022-09-09Change detection of already executed migrations (#2665)Till
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-07Use a single context insteadNeil Alexander
2022-09-07Update state reset capture to SentryNeil Alexander
2022-09-05Improve Sentry reportingNeil Alexander
2022-09-05Tweak logging for detected state resetsNeil Alexander
2022-09-05Move `SetLatestEvents` callNeil Alexander
2022-08-25Remove a couple unnecessary Sentry captures from backfillNeil Alexander
2022-08-25Tweak logging and Sentry reporting for roomserver inputNeil Alexander
2022-08-25Fix 500s on `/state`, `/state_ids` when state not known (#2672)Neil Alexander
This was due to bad error bubbling.
2022-08-24Allow un-rejecting events on reprocessingNeil Alexander
2022-08-23Detect `types.MissingStateError` in `CheckServerAllowedToSeeEvent` (#2667)Neil Alexander
This will hopefully stop some 500 errors on `/event` where there is no state-before known.
2022-08-22Tweak soft-failure handling in roomserverNeil Alexander
commit 1929b688e31987c46e0c8a546f0f9cb0a46bf9a3 Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Mon Aug 22 10:09:44 2022 +0100 Still process state-before for soft-failed events commit e83c0b701d40d78b92072c4643f6bc6f71b72800 Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Mon Aug 22 10:06:50 2022 +0100 Improve logging commit 29e26124bc27cb83d449de2a4214b253c594aa93 Author: Neil Alexander <neilalexander@users.noreply.github.com> Date: Mon Aug 22 09:58:13 2022 +0100 Don't store soft-failed events as rejected
2022-08-19Set historyVisibility for backfilled events over federation (#2656)Till
This should hopefully deflake Backfill works correctly with history visibility set to joined as we were using the default shared visibility, even if the events are set to joined (or something else)
2022-08-18State handling tweaks (#2652)Neil Alexander
This tweaks how rejected events are handled in room state and also to not apply checks we can't complete to outliers.
2022-08-18Reprocess rejected input events (#2647)Neil Alexander
* Reprocess outliers that were previously rejected * Might as well do all events this way * More useful errors * Fix queries * Tweak condition * Don't wrap errors * Report more useful error * Flatten error on `r.Queryer.QueryStateAfterEvents` * Some more debug logging * Flatten error in `QueryRestrictedJoinAllowed` * Revert "Flatten error in `QueryRestrictedJoinAllowed`" This reverts commit 1238b4184c30e0c31ffb0f364806fa1275aba483. * Tweak `QueryStateAfterEvents` * Handle MissingStateError too * Scope to room * Clean up * Fix the error * Only apply rejection check to outliers
2022-08-12Show/hide users in user directory (#2637)Till
* CS API changes * Query remote profiles * Add passing tests * Don't create a new FullyQualifiedProfile * Handle sql.ErrNoRows Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2022-08-11Restore the room version cache in the roomserver internal API HTTP clientNeil Alexander
2022-08-11Implement history visibility on `/messages`, `/context`, `/sync` (#2511)Till
* Add possibility to set history_visibility and user AccountType * Add new DB queries * Add actual history_visibility changes for /messages * Add passing tests * Extract check function * Cleanup * Cleanup * Fix build on 386 * Move ApplyHistoryVisibilityFilter to internal * Move queries to topology table * Add filtering to /sync and /context Some cleanup * Add passing tests; Remove failing tests :( * Re-add passing tests * Move filtering to own function to avoid duplication * Re-add passing test * Use newly added GMSL HistoryVisibility * Update gomatrixserverlib * Set the visibility when creating events * Default to shared history visibility * Remove unused query * Update history visibility checks to use gmsl Update tests * Remove unused statement * Update migrations to set "correct" history visibility * Add method to fetch the membership at a given event * Tweaks and logging * Use actual internal rsAPI, default to shared visibility in tests * Revert "Move queries to topology table" This reverts commit 4f0d41be9c194a46379796435ce73e79203edbd6. * Remove noise/unneeded code * More cleanup * Try to optimize database requests * Fix imports * PR peview fixes/changes * Move setting history visibility to own migration, be more restrictive * Fix unit tests * Lint * Fix missing entries * Tweaks for incremental syncs * Adapt generic changes Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com> Co-authored-by: kegsay <kegan@matrix.org>
2022-08-11Set default room version to 9Neil Alexander
2022-08-11Generic-based internal HTTP API (#2626)Neil Alexander
* Generic-based internal HTTP API (tested out on a few endpoints in the federation API) * Add `PerformInvite` * More tweaks * Fix metric name * Fix LookupStateIDs * Lots of changes to clients * Some serverside stuff * Some error handling * Use paths as metric names * Revert "Use paths as metric names" This reverts commit a9323a6a343f5ce6461a2e5bd570fe06465f1b15. * Namespace metric names * Remove duplicate entry * Remove another duplicate entry * Tweak error handling * Some more tweaks * Update error behaviour * Some more error tweaking * Fix API path for `PerformDeleteKeys` * Fix another path * Tweak federation client proxying * Fix another path * Don't return typed nils * Some more tweaks, not that it makes any difference * Tweak federation client proxying * Maybe fix the key backup test
2022-08-08Fix issues with migrations not getting executed (#2628)Till
* Fix issues with migrations not getting executed * Check actual postgres error * Return error if it's not "column does not exist"
2022-08-05Fix linter issues (#2624)Till
* Try that again * All hail the mighty linter? * And once again * goimport all the things
2022-08-03Try more servers when calling `/state_ids` (#2610)Neil Alexander
* Try more servers when calling `/state_ids` * More logging * Maybe fix concurrent map write * Revert "Maybe fix concurrent map write" This reverts commit da0dbb836207a911afe77e6f6d63c4809669693c. * Enforce a limit of 20s per server, 5 mins total
2022-08-03Remove roominfo cache (#2615)Neil Alexander
* Remove roominfo cache It's the source of a number of race conditions which are seemingly causing bugs and CI failures. * Make the linter less sad
2022-08-02Fix data race in `lookupMissingStateViaStateIDs`Neil Alexander
2022-08-02Various roominfo tweaks (#2607)Neil Alexander
2022-08-01De-race `types.RoomInfo` (#2600)Neil Alexander
2022-08-01Optimise checking other servers allowed to see events (#2596)Neil Alexander
* Try optimising checking if server is allowed to see event * Fix error * Handle case where snapshot NID is 0 * Fix query * Update SQL * Clean up `CheckServerAllowedToSeeEvent` * Not supported on SQLite * Maybe placate the unit tests * Review comments
2022-07-25Update database migrations, remove goose (#2264)Till
* Add new db migration * Update migrations Remove goose * Add possibility to test direct upgrades * Try to fix WASM test * Add checks for specific migrations * Remove AddMigration Use WithTransaction Add Dendrite version to table * Fix linter issues * Update tests * Update comments, outdent if * Namespace migrations * Add direct upgrade tests, skipping over one version * Split migrations * Update go version in CI * Fix copy&paste mistake * Use contexts in migrations Co-authored-by: kegsay <kegan@matrix.org> Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2022-07-22Try to fix HTTP 500s on `/members` (#2581)Neil Alexander
2022-07-22Membership updater refactoring (#2541)Neil Alexander
* Membership updater refactoring * Pass in membership state * Use membership check rather than referring to state directly * Delete irrelevant membership states * We don't need the leave event after all * Tweaks * Put a log entry in that I might stand a chance of finding * Be less panicky * Tweak invite handling * Don't freak if we can't find the event NID * Use event NID from `types.Event` * Clean up * Better invite handling * Placate the almighty linter * Blacklist a Sytest which is otherwise fine under Complement for reasons I don't understand * Fix the sytest after all (thanks @S7evinK for the spot)
2022-07-20Fix issue with membership event_nid being 0 (#2580)Till
2022-07-19Add event state key cache (#2576)Neil Alexander
2022-07-13Pointerise `types.RoomInfo` in the cache so we can update it in-place in the ↵Neil Alexander
latest events updater