summary refs log tree commit diff
path: root/synapse/storage/schema (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add support to purge rows from MSC2716 and other tables when purging a room ↵Eric Eastwood2022-09-162-0/+24
| | | | | | | | | | | (#13825) `event_failed_pull_attempts` added in https://github.com/matrix-org/synapse/pull/13589 MSC2716 related tables added in: - https://github.com/matrix-org/synapse/pull/10245/files#diff-3d42dfb44d02f7de3aada105e0bdc1cc9dd7f953cbf0f36c5d0f50827bf0320aR1 - Renamed in https://github.com/matrix-org/synapse/pull/10838/files#diff-2730bfbe9e688b55e46f9371aefe67dac2bd2b2b7d9d6b92774eea1fcfae156dR1 - https://github.com/matrix-org/synapse/pull/10498/files#diff-c52bbfbb5921a3f6f023b24343668479d966fac164f13b7c39d2197ce3afa7a5R1
* Keep track when we try and fail to process a pulled event (#13589)Eric Eastwood2022-09-142-0/+31
| | | | | | | | | | | | | | We can follow-up this PR with: 1. Only try to backfill from an event if we haven't tried recently -> https://github.com/matrix-org/synapse/issues/13622 1. When we decide to backfill that event again, process it in the background so it doesn't block and make `/messages` slow when we know it will probably fail again -> https://github.com/matrix-org/synapse/issues/13623 1. Generally track failures everywhere we try and fail to pull an event over federation -> https://github.com/matrix-org/synapse/issues/13700 Fix https://github.com/matrix-org/synapse/issues/13621 Part of https://github.com/matrix-org/synapse/issues/13356 Mentioned in [internal doc](https://docs.google.com/document/d/1lvUoVfYUiy6UaHB6Rb4HicjaJAU40-APue9Q4vzuW3c/edit#bookmark=id.qv7cj51sv9i5)
* Update event push action and receipt tables to support threads. (#13753)Patrick Cloke2022-09-145-1/+155
| | | | | | | | | | | | | | | Adds a `thread_id` column to the `event_push_actions`, `event_push_actions_staging`, and `event_push_summary` tables. This will notifications to be segmented by the thread in a future pull request. The `thread_id` column stores the root event ID or the special value `"main"`. The `thread_id` column for `event_push_actions` and `event_push_summary` is backfilled with `"main"` for all existing rows. New entries into `event_push_actions` and `event_push_actions_staging` will get the proper thread ID. `receipts_linearized` and `receipts_graph` also gain a `thread_id` column, which is similar, except `NULL` is a special value meaning the receipt is "unthreaded". See MSC3771 and MSC3773 for where this data will be useful.
* Use partial indices on SQLIte. (#13802)Patrick Cloke2022-09-141-0/+56
| | | | | | | Partial indices have been supported since SQLite 3.8, but Synapse now requires >= 3.27, so we can enable support for them. This requires rebuilding previous indices which were partial on PostgreSQL, but not on SQLite.
* Remove incorrect migration file from `state` logical DB (#13788)David Robertson2022-09-141-37/+0
| | | | | | | | | | | | | * Remove incorrect migration file from `state` logical DB The table `ex_outlier_stream` is part of the `main` logical DB; it should not have been created in the `state` logical DB. We remove this migration now as a tidy-up. Note: we cannot `DROP TABLE IF EXISTS ex_outlier_stream` in a new migration, because some (most) instances of Synapse host both of these logical DBs on the same DB cluster. * Changelog
* Make sequence `cache_invalidation_stream_seq` begin at `2` (#13766)Mathieu Velten2022-09-132-0/+24
| | | | Signed-off-by: Mathieu Velten <mathieuv@matrix.org> Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Updates to the schema dump script (#13770)David Robertson2022-09-131-0/+4
|
* Add receipts event stream ordering (#13703)Nick Mills-Barrett2022-09-131-0/+19
|
* Remove check current state membership up to date (#13745)Nick Mills-Barrett2022-09-121-0/+52
| | | | | | | * Remove checks for membership column in current_state_events * Add schema script to force through the `current_state_events_membership` background job Contributed by Nick @ Beeper (@fizzadar).
* Add timestamp to user's consent (#13741)Dirk Klimpel2022-09-081-0/+16
| | | Co-authored-by: reivilibre <olivier@librepush.net>
* Add a schema delta to drop unstable private read receipts. (#13692)Patrick Cloke2022-09-011-0/+19
| | | | Otherwise they'll be leaked due to the filtering code only respecting the stable identifiers for private read receipts.
* Drop unused column `application_services_state.last_txn` (#13627)Shay2022-08-303-0/+58
|
* Bg update to populate new `events` table columns (#13215)Richard van der Hoff2022-07-151-0/+47
| | | | | These columns were added back in Synapse 1.52, and have been populated for new events since then. It's now (beyond) time to back-populate them for existing events.
* Drop unused tables from groups/communities. (#12967)Patrick Cloke2022-07-132-3/+35
| | | | These tables have been unused since Synapse v1.61.0, although schema version 72 was added in Synapse v1.62.0.
* Drop unused table `event_reference_hashes` (#13218)Richard van der Hoff2022-07-121-0/+17
| | | This is unused since Synapse 1.60.0 (#12679). It's time for it to go.
* Merge remote-tracking branch 'origin/release-v1.62' into developPatrick Cloke2022-06-301-0/+19
|\
| * Add index to help delete old push actions (#13141)Erik Johnston2022-06-301-0/+19
| |
* | Implement MSC3827: Filtering of `/publicRooms` by room type (#13031)Šimon Brandner2022-06-291-0/+19
|/ | | | Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
* Fix serialization errors when rotating notifications (#13118)Erik Johnston2022-06-281-0/+35
|
* Speed up `get_unread_event_push_actions_by_room` (#13005)Erik Johnston2022-06-152-3/+22
| | | | | | | | | | | Fixes #11887 hopefully. The core change here is that `event_push_summary` now holds a summary of counts up until a much more recent point, meaning that the range of rows we need to count in `event_push_actions` is much smaller. This needs two major changes: 1. When we get a receipt we need to recalculate `event_push_summary` rather than just delete it 2. The logic for deleting `event_push_actions` is now divorced from calculating `event_push_summary`. In future it would be good to calculate `event_push_summary` while we persist a new event (it should just be a case of adding one to the relevant rows in `event_push_summary`), as that will further simplify the get counts logic and remove the need for us to periodically update `event_push_summary` in a background job.
* Clean up schema for `event_edges` (#12893)Richard van der Hoff2022-06-153-5/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove redundant references to `event_edges.room_id` We don't need to care about the room_id here, because we are already checking the event id. * Clean up the event_edges table We make a number of changes to `event_edges`: * We give the `room_id` and `is_state` columns defaults (null and false respectively) so that we can stop populating them. * We drop any rows that have `is_state` set true - they should no longer exist. * We drop any rows that do not exist in `events` - these should not exist either. * We drop the old unique constraint on all the colums, which wasn't much use. * We create a new unique index on `(event_id, prev_event_id)`. * We add a foreign key constraint to `events`. These happen rather differently depending on whether we are on Postgres or SQLite. For SQLite, we just rebuild the whole table, copying only the rows we want to keep. For Postgres, we try to do things in the background as much as possible. * Stop populating `event_edges.room_id` and `is_state` We can just rely on the defaults.
* Rename delta to apply in the proper schema version. (#13050)Patrick Cloke2022-06-141-0/+0
|
* Replace noop background updates with DELETE. (#12954)Patrick Cloke2022-06-131-0/+61
| | | | Removes the `register_noop_background_update` and deletes the background updates directly in a delta file.
* Remove remaining pieces of groups code. (#12966)Patrick Cloke2022-06-061-0/+1
| | | | | * Remove an unused stream ID generator. * Remove the now unused remote profile cache.
* Stop reading from `event_edges.room_id`. (#12914)Richard van der Hoff2022-05-311-1/+4
| | | event_edges.room_id is implied by the event id, so there is no need to join on the room id.
* Add a migration step to cleanup potential leftovers of bug 11833 (#12784)Mathieu Velten2022-05-301-0/+19
| | | Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Add a unique index to `state_group_edges` to prevent duplicates being ↵reivilibre2022-05-191-0/+17
| | | | accidentally introduced and the consequential impact to performance. (#12687)
* Remove code which updates `application_services_state.last_txn` (#12680)Richard van der Hoff2022-05-171-1/+4
| | | | This column is unused as of #12209, so let's stop writing to it.
* Add index to cache invalidations (#12747)Erik Johnston2022-05-171-0/+18
| | | | | For workers that rarely write to the cache the `get_all_updated_caches` query can become expensive if the worker falls behind when reading the cache.
* Stop writing to `event_reference_hashes` (#12679)Richard van der Hoff2022-05-101-1/+4
| | | | | This table is never read, since #11794. We stop writing to it; in future we can drop it altogether.
* Process device list updates asynchronously (#12365)Erik Johnston2022-04-121-3/+3
|
* Track device list updates per room. (#12321)Erik Johnston2022-04-042-0/+39
| | | | | | | | | | | | | | This is a first step in dealing with #7721. The idea is basically that rather than calculating the full set of users a device list update needs to be sent to up front, we instead simply record the rooms the user was in at the time of the change. This will allow a few things: 1. we can defer calculating the set of remote servers that need to be poked about the change; and 2. during `/sync` and `/keys/changes` we can avoid also avoid calculating users who share rooms with other users, and instead just look at the rooms that have changed. However, care needs to be taken to correctly handle server downgrades. As such this PR writes to both `device_lists_changes_in_room` and the `device_lists_outbound_pokes` table synchronously. In a future release we can then bump the database schema compat version to `69` and then we can assume that the new `device_lists_changes_in_room` exists and is handled. There is a temporary option to disable writing to `device_lists_outbound_pokes` synchronously, allowing us to test the new code path does work (and by implication upgrading to a future release and downgrading to this one will work correctly). Note: Ideally we'd do the calculation of room to servers on a worker (e.g. the background worker), but currently only master can write to the `device_list_outbound_pokes` table.
* Use a sequence to generate AS transaction IDs, drop `last_txn` AS state (#12209)Nick Mills-Barrett2022-04-012-1/+48
| | | | | | | | Switching to a sequence means there's no need to track `last_txn` on the AS state table to generate new TXN IDs. This also means that there is no longer contention between the AS scheduler and AS handler on updates to the `application_services_state` table, which will prevent serialization errors during the complete AS txn transaction.
* Send device list updates to application services (MSC3202) - part 1 (#11881)Andrew Morgan2022-03-301-0/+23
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Remove unnecessary pass statements. (#12206)Patrick Cloke2022-03-111-1/+0
|
* Faster joins: persist to database (#12012)Richard van der Hoff2022-03-012-0/+113
| | | | | | | | | | | | When we get a partial_state response from send_join, store information in the database about it: * store a record about the room as a whole having partial state, and stash the list of member servers too. * flag the join event itself as having partial state * also, for any new events whose prev-events are partial-stated, note that they will *also* be partial-stated. We don't yet make any attempt to interpret this data, so API calls (and a bunch of other things) are just going to get incorrect data.
* Fix non-strings in the `event_search` table (#12037)Sean Quah2022-02-241-0/+22
| | | | | | | Don't attempt to add non-string `value`s to `event_search` and add a background update to clear out bad rows from `event_search` when using sqlite. Signed-off-by: Sean Quah <seanq@element.io>
* Fix slow performance of `/logout` in some cases where refresh tokens are in ↵reivilibre2022-02-221-0/+28
| | | | use. The slowness existed since the initial implementation of refresh tokens. (#12056)
* Add a background database update to purge account data for deactivated ↵reivilibre2022-02-021-0/+20
| | | | users. (#11655)
* Send to-device messages to application services (#11215)Andrew Morgan2022-02-011-0/+21
| | | Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Add `state_key` and `rejection_reason` to `events` (#11792)Richard van der Hoff2022-01-212-3/+31
| | | | ... and start populating them for new events
* Drop unused table `public_room_list_stream`. (#11795)Richard van der Hoff2022-01-212-1/+21
| | | This is a follow-up to #10565.
* Stop reading from `event_reference_hashes` (#11794)Richard van der Hoff2022-01-211-1/+4
| | | | Preparation for dropping this table altogether. Part of #6574.
* Stop populating `state_events.prev_state` (#11558)Richard van der Hoff2021-12-101-1/+4
| | | this field is never read, so we may as well stop populating it.
* Save the OIDC session ID (sid) with the device on login (#11482)Quentin Gliech2021-12-061-0/+27
| | | As a step towards allowing back-channel logout for OIDC.
* Disambiguate queries on `state_key` (#11497)Richard van der Hoff2021-12-021-1/+5
| | | | | We're going to add a `state_key` column to the `events` table, so we need to add some disambiguation to queries which use it.
* Support expiry of refresh tokens and expiry of the overall session when ↵reivilibre2021-11-261-0/+28
| | | | refresh tokens are in use. (#11425)
* Improve performance of `remove_{hidden,deleted}_devices_from_device_inbox` ↵Brendan Abolivier2021-11-251-0/+18
| | | | | (#11421) Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Store arbitrary relations from events. (#11391)Patrick Cloke2021-11-221-1/+1
| | | | | Instead of only known relation types. This also reworks the background update for thread relations to crawl events and search for any relation type, not just threaded relations.
* Merge tag 'v1.47.0rc3' into developDavid Robertson2021-11-161-1/+13
|\ | | | | | | | | | | | | | | | | | | | | Synapse 1.47.0rc3 (2021-11-16) ============================== Bugfixes -------- - Fix a bug introduced in 1.47.0rc1 which caused worker processes to not halt startup in the presence of outstanding database migrations. ([\#11346](https://github.com/matrix-org/synapse/issues/11346)) - Fix a bug introduced in 1.47.0rc1 which prevented the 'remove deleted devices from `device_inbox` column' background process from running when updating from a recent Synapse version. ([\#11303](https://github.com/matrix-org/synapse/issues/11303), [\#11353](https://github.com/matrix-org/synapse/issues/11353))
| * Rename `remove_deleted_devices_from_device_inbox` to ensure it is always run ↵Andrew Morgan2021-11-161-1/+13
| | | | | | | | | | (#11353) Co-authored-by: reivilibre <oliverw@matrix.org>
| * Move sql file for `remove_deleted_devices_from_device_inbox` into v65 (#11303)Dirk Klimpel2021-11-151-1/+1
| |
* | Remove unused tables `room_stats_historical` and `user_stats_historical` ↵Shay2021-11-122-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#11280) * remove unused tables room_stats_historical and user_stats_historical * update changelog number * Bump schema compat version comment * make linter happy * Update comment to give more info Co-authored-by: reivilibre <oliverw@matrix.org> Co-authored-by: reivilibre <oliverw@matrix.org>
* | Move sql file for `remove_deleted_devices_from_device_inbox` into v65 (#11303)Dirk Klimpel2021-11-111-1/+1
|/
* Add index to `local_group_updates.stream_id` (#11231)Erik Johnston2021-11-021-0/+18
| | | | This should speed up startup times and generally increase performance of groups.
* Delete messages for hidden devices from `device_inbox` (#11199)Dirk Klimpel2021-11-021-0/+22
|
* Fix comments referencing v1.46.0 from PR #10969. (#11212)Dirk Klimpel2021-10-291-1/+1
| | | | #10969 was merged after 1.46.0rc1 was cut and will be included in v1.47.0rc1 instead.
* Delete messages from `device_inbox` table when deleting device (#10969)Dirk Klimpel2021-10-271-0/+22
| | | Fixes: #9346
* Add a background update for updating MSC3440 relation threads. (#11181)Patrick Cloke2021-10-261-0/+18
|
* Resolve and share `state_groups` for all historical events in batch ↵Eric Eastwood2021-10-132-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (MSC2716) (#10975) Resolve and share `state_groups` for all historical events in batch. This also helps for showing the appropriate avatar/displayname in Element and will work whenever `/messages` has one of the historical messages as the first message in the batch. This does have the flaw where if you just insert a single historical event somewhere, it probably won't resolve the state correctly from `/messages` or `/context` since it will grab a non historical event above or below with resolved state which never included the historical state back then. For the same reasions, this also does not work in Element between the transition from actual messages to historical messages. In the Gitter case, this isn't really a problem since all of the historical messages are in one big lump at the beginning of the room. For a future iteration, might be good to look at `/messages` and `/context` to additionally add the `state` for any historical messages in that batch. --- How are the `state_groups` shared? To illustrate the `state_group` sharing, see this example: **Before** (new `state_group` for every event 😬, very inefficient): ``` # Tests from https://github.com/matrix-org/complement/pull/206 $ COMPLEMENT_ALWAYS_PRINT_SERVER_LOGS=1 COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh TestBackfillingHistory/parallel/should_resolve_member_state_events_for_historical_events create_new_client_event m.room.member event=$_JXfwUDIWS6xKGG4SmZXjSFrizhARM7QblhATVWWUcA state_group=None create_new_client_event org.matrix.msc2716.insertion event=$1ZBfmBKEjg94d-vGYymKrVYeghwBOuGJ3wubU1-I9y0 state_group=9 create_new_client_event org.matrix.msc2716.insertion event=$Mq2JvRetTyclPuozRI682SAjYp3GqRuPc8_cH5-ezPY state_group=10 create_new_client_event m.room.message event=$MfmY4rBQkxrIp8jVwVMTJ4PKnxSigpG9E2cn7S0AtTo state_group=11 create_new_client_event m.room.message event=$uYOv6V8wiF7xHwOMt-60d1AoOIbqLgrDLz6ZIQDdWUI state_group=12 create_new_client_event m.room.message event=$PAbkJRMxb0bX4A6av463faiAhxkE3FEObM1xB4D0UG4 state_group=13 create_new_client_event org.matrix.msc2716.batch event=$Oy_S7AWN7rJQe_MYwGPEy6RtbYklrI-tAhmfiLrCaKI state_group=14 ``` **After** (all events in batch sharing `state_group=10`) (the base insertion event has `state_group=8` which matches the `prev_event` we're inserting next to): ``` # Tests from https://github.com/matrix-org/complement/pull/206 $ COMPLEMENT_ALWAYS_PRINT_SERVER_LOGS=1 COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh TestBackfillingHistory/parallel/should_resolve_member_state_events_for_historical_events create_new_client_event m.room.member event=$PWomJ8PwENYEYuVNoG30gqtybuQQSZ55eldBUSs0i0U state_group=None create_new_client_event org.matrix.msc2716.insertion event=$e_mCU7Eah9ABF6nQU7lu4E1RxIWccNF05AKaTT5m3lw state_group=9 create_new_client_event org.matrix.msc2716.insertion event=$ui7A3_GdXIcJq0C8GpyrF8X7B3DTjMd_WGCjogax7xU state_group=10 create_new_client_event m.room.message event=$EnTIM5rEGVezQJiYl62uFBl6kJ7B-sMxWqe2D_4FX1I state_group=10 create_new_client_event m.room.message event=$LGx5jGONnBPuNhAuZqHeEoXChd9ryVkuTZatGisOPjk state_group=10 create_new_client_event m.room.message event=$wW0zwoN50lbLu1KoKbybVMxLbKUj7GV_olozIc5i3M0 state_group=10 create_new_client_event org.matrix.msc2716.batch event=$5ZB6dtzqFBCEuMRgpkU201Qhx3WtXZGTz_YgldL6JrQ state_group=10 ```
* Drop backwards-compatibility support for "outlier" (#10903)Richard van der Hoff2021-09-281-4/+2
| | | | | Before Synapse 1.31 (#9411), we relied on `outlier` being stored in the `internal_metadata` column. We can now assume nobody will roll back their deployment that far and drop the legacy support.
* Document changes to schema version 61 - 64 (#10917)Eric Eastwood2021-09-241-0/+11
| | | | | As pointed out by @richvdh, https://github.com/matrix-org/synapse/pull/10838#discussion_r715424244 Retroactively summarize `61` - `64`
* Use direct references for some configuration variables (part 3) (#10885)Patrick Cloke2021-09-231-1/+1
| | | | | | | | This avoids the overhead of searching through the various configuration classes by directly referencing the class that the attributes are in. It also improves type hints since mypy can now resolve the types of the configuration variables.
* Rename MSC2716 things from `chunk` to `batch` to match `/batch_send` ↵Eric Eastwood2021-09-213-1/+61
| | | | | | | | endpoint (#10838) See https://github.com/matrix-org/matrix-doc/pull/2716#discussion_r684574497 Dropping support for older MSC2716 room versions so we don't have to worry about supporting both chunk and batch events.
* Use direct references for some configuration variables (#10798)Patrick Cloke2021-09-132-2/+2
| | | | Instead of proxying through the magic getter of the RootConfig object. This should be more performant (and is more explicit).
* Add a partial index to `presence_stream` to speed up startups (#10748)Sean2021-09-031-0/+18
| | | Signed-off-by: Sean Quah <seanq@element.io>
* Populate `rooms.creator` field for easy lookup (#10697)Eric Eastwood2021-09-011-0/+17
| | | | | | Part of https://github.com/matrix-org/synapse/pull/10566 - Fill in creator whenever we insert into the rooms table - Add background update to backfill any missing creator values
* Move the sessions delta to the latest schema version. (#10725)Patrick Cloke2021-08-311-0/+0
| | | This was erroneously put under schema version 62 instead of 63.
* Remove pushers when deleting 3pid from account (#10581)Azrenbeth2021-08-261-0/+20
| | | | | When a user deletes an email from their account it will now also remove all pushers for that email and that user (even if these pushers were created by a different client)
* Make a note to leave a summary when one is bumping the schema version (#10621)Andrew Morgan2021-08-251-0/+2
| | | I found this easy to miss (and evidently, it looks like it was missed for schema version 62).
* Persist room hierarchy pagination sessions to the database. (#10613)Patrick Cloke2021-08-241-0/+23
|
* Implement MSC3231: Token authenticated registration (#10142)Callum Brown2021-08-211-0/+23
| | | | | Signed-off-by: Callum Brown <callum@calcuode.com> This is part of my GSoC project implementing [MSC3231](https://github.com/matrix-org/matrix-doc/pull/3231).
* Remove the unused public_room_list_stream (#10565)Andrew Morgan2021-08-171-1/+6
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* update links to schema doc (#10620)Richard van der Hoff2021-08-172-3/+3
|
* Add support for MSC2716 marker events (#10498)Eric Eastwood2021-08-042-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make historical messages available to federated servers Part of MSC2716: https://github.com/matrix-org/matrix-doc/pull/2716 Follow-up to https://github.com/matrix-org/synapse/pull/9247 * Debug message not available on federation * Add base starting insertion point when no chunk ID is provided * Fix messages from multiple senders in historical chunk Follow-up to https://github.com/matrix-org/synapse/pull/9247 Part of MSC2716: https://github.com/matrix-org/matrix-doc/pull/2716 --- Previously, Synapse would throw a 403, `Cannot force another user to join.`, because we were trying to use `?user_id` from a single virtual user which did not match with messages from other users in the chunk. * Remove debug lines * Messing with selecting insertion event extremeties * Move db schema change to new version * Add more better comments * Make a fake requester with just what we need See https://github.com/matrix-org/synapse/pull/10276#discussion_r660999080 * Store insertion events in table * Make base insertion event float off on its own See https://github.com/matrix-org/synapse/pull/10250#issuecomment-875711889 Conflicts: synapse/rest/client/v1/room.py * Validate that the app service can actually control the given user See https://github.com/matrix-org/synapse/pull/10276#issuecomment-876316455 Conflicts: synapse/rest/client/v1/room.py * Add some better comments on what we're trying to check for * Continue debugging * Share validation logic * Add inserted historical messages to /backfill response * Remove debug sql queries * Some marker event implemntation trials * Clean up PR * Rename insertion_event_id to just event_id * Add some better sql comments * More accurate description * Add changelog * Make it clear what MSC the change is part of * Add more detail on which insertion event came through * Address review and improve sql queries * Only use event_id as unique constraint * Fix test case where insertion event is already in the normal DAG * Remove debug changes * Add support for MSC2716 marker events * Process markers when we receive it over federation * WIP: make hs2 backfill historical messages after marker event * hs2 to better ask for insertion event extremity But running into the `sqlite3.IntegrityError: NOT NULL constraint failed: event_to_state_groups.state_group` error * Add insertion_event_extremities table * Switch to chunk events so we can auth via power_levels Previously, we were using `content.chunk_id` to connect one chunk to another. But these events can be from any `sender` and we can't tell who should be able to send historical events. We know we only want the application service to do it but these events have the sender of a real historical message, not the application service user ID as the sender. Other federated homeservers also have no indicator which senders are an application service on the originating homeserver. So we want to auth all of the MSC2716 events via power_levels and have them be sent by the application service with proper PL levels in the room. * Switch to chunk events for federation * Add unstable room version to support new historical PL * Messy: Fix undefined state_group for federated historical events ``` 2021-07-13 02:27:57,810 - synapse.handlers.federation - 1248 - ERROR - GET-4 - Failed to backfill from hs1 because NOT NULL constraint failed: event_to_state_groups.state_group Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 1216, in try_backfill await self.backfill( File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 1035, in backfill await self._auth_and_persist_event(dest, event, context, backfilled=True) File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 2222, in _auth_and_persist_event await self._run_push_actions_and_persist_event(event, context, backfilled) File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 2244, in _run_push_actions_and_persist_event await self.persist_events_and_notify( File "/usr/local/lib/python3.8/site-packages/synapse/handlers/federation.py", line 3290, in persist_events_and_notify events, max_stream_token = await self.storage.persistence.persist_events( File "/usr/local/lib/python3.8/site-packages/synapse/logging/opentracing.py", line 774, in _trace_inner return await func(*args, **kwargs) File "/usr/local/lib/python3.8/site-packages/synapse/storage/persist_events.py", line 320, in persist_events ret_vals = await yieldable_gather_results(enqueue, partitioned.items()) File "/usr/local/lib/python3.8/site-packages/synapse/storage/persist_events.py", line 237, in handle_queue_loop ret = await self._per_item_callback( File "/usr/local/lib/python3.8/site-packages/synapse/storage/persist_events.py", line 577, in _persist_event_batch await self.persist_events_store._persist_events_and_state_updates( File "/usr/local/lib/python3.8/site-packages/synapse/storage/databases/main/events.py", line 176, in _persist_events_and_state_updates await self.db_pool.runInteraction( File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 681, in runInteraction result = await self.runWithConnection( File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 770, in runWithConnection return await make_deferred_yieldable( File "/usr/local/lib/python3.8/site-packages/twisted/python/threadpool.py", line 238, in inContext result = inContext.theWork() # type: ignore[attr-defined] File "/usr/local/lib/python3.8/site-packages/twisted/python/threadpool.py", line 254, in <lambda> inContext.theWork = lambda: context.call( # type: ignore[attr-defined] File "/usr/local/lib/python3.8/site-packages/twisted/python/context.py", line 118, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/usr/local/lib/python3.8/site-packages/twisted/python/context.py", line 83, in callWithContext return func(*args, **kw) File "/usr/local/lib/python3.8/site-packages/twisted/enterprise/adbapi.py", line 293, in _runWithConnection compat.reraise(excValue, excTraceback) File "/usr/local/lib/python3.8/site-packages/twisted/python/deprecate.py", line 298, in deprecatedFunction return function(*args, **kwargs) File "/usr/local/lib/python3.8/site-packages/twisted/python/compat.py", line 403, in reraise raise exception.with_traceback(traceback) File "/usr/local/lib/python3.8/site-packages/twisted/enterprise/adbapi.py", line 284, in _runWithConnection result = func(conn, *args, **kw) File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 765, in inner_func return func(db_conn, *args, **kwargs) File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 549, in new_transaction r = func(cursor, *args, **kwargs) File "/usr/local/lib/python3.8/site-packages/synapse/logging/utils.py", line 69, in wrapped return f(*args, **kwargs) File "/usr/local/lib/python3.8/site-packages/synapse/storage/databases/main/events.py", line 385, in _persist_events_txn self._store_event_state_mappings_txn(txn, events_and_contexts) File "/usr/local/lib/python3.8/site-packages/synapse/storage/databases/main/events.py", line 2065, in _store_event_state_mappings_txn self.db_pool.simple_insert_many_txn( File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 923, in simple_insert_many_txn txn.execute_batch(sql, vals) File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 280, in execute_batch self.executemany(sql, args) File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 300, in executemany self._do_execute(self.txn.executemany, sql, *args) File "/usr/local/lib/python3.8/site-packages/synapse/storage/database.py", line 330, in _do_execute return func(sql, *args) sqlite3.IntegrityError: NOT NULL constraint failed: event_to_state_groups.state_group ``` * Revert "Messy: Fix undefined state_group for federated historical events" This reverts commit 187ab28611546321e02770944c86f30ee2bc742a. * Fix federated events being rejected for no state_groups Add fix from https://github.com/matrix-org/synapse/pull/10439 until it merges. * Adapting to experimental room version * Some log cleanup * Add better comments around extremity fetching code and why * Rename to be more accurate to what the function returns * Add changelog * Ignore rejected events * Use simplified upsert * Add Erik's explanation of extra event checks See https://github.com/matrix-org/synapse/pull/10498#discussion_r680880332 * Clarify that the depth is not directly correlated to the backwards extremity that we return See https://github.com/matrix-org/synapse/pull/10498#discussion_r681725404 * lock only matters for sqlite See https://github.com/matrix-org/synapse/pull/10498#discussion_r681728061 * Move new SQL changes to its own delta file * Clean up upsert docstring * Bump database schema version (62)
* Make historical events discoverable from backfill for servers without any ↵Eric Eastwood2021-07-281-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | scrollback history (MSC2716) (#10245) * Make historical messages available to federated servers Part of MSC2716: https://github.com/matrix-org/matrix-doc/pull/2716 Follow-up to https://github.com/matrix-org/synapse/pull/9247 * Debug message not available on federation * Add base starting insertion point when no chunk ID is provided * Fix messages from multiple senders in historical chunk Follow-up to https://github.com/matrix-org/synapse/pull/9247 Part of MSC2716: https://github.com/matrix-org/matrix-doc/pull/2716 --- Previously, Synapse would throw a 403, `Cannot force another user to join.`, because we were trying to use `?user_id` from a single virtual user which did not match with messages from other users in the chunk. * Remove debug lines * Messing with selecting insertion event extremeties * Move db schema change to new version * Add more better comments * Make a fake requester with just what we need See https://github.com/matrix-org/synapse/pull/10276#discussion_r660999080 * Store insertion events in table * Make base insertion event float off on its own See https://github.com/matrix-org/synapse/pull/10250#issuecomment-875711889 Conflicts: synapse/rest/client/v1/room.py * Validate that the app service can actually control the given user See https://github.com/matrix-org/synapse/pull/10276#issuecomment-876316455 Conflicts: synapse/rest/client/v1/room.py * Add some better comments on what we're trying to check for * Continue debugging * Share validation logic * Add inserted historical messages to /backfill response * Remove debug sql queries * Some marker event implemntation trials * Clean up PR * Rename insertion_event_id to just event_id * Add some better sql comments * More accurate description * Add changelog * Make it clear what MSC the change is part of * Add more detail on which insertion event came through * Address review and improve sql queries * Only use event_id as unique constraint * Fix test case where insertion event is already in the normal DAG * Remove debug changes * Switch to chunk events so we can auth via power_levels Previously, we were using `content.chunk_id` to connect one chunk to another. But these events can be from any `sender` and we can't tell who should be able to send historical events. We know we only want the application service to do it but these events have the sender of a real historical message, not the application service user ID as the sender. Other federated homeservers also have no indicator which senders are an application service on the originating homeserver. So we want to auth all of the MSC2716 events via power_levels and have them be sent by the application service with proper PL levels in the room. * Switch to chunk events for federation * Add unstable room version to support new historical PL * Fix federated events being rejected for no state_groups Add fix from https://github.com/matrix-org/synapse/pull/10439 until it merges. * Only connect base insertion event to prev_event_ids Per discussion with @erikjohnston, https://matrix.to/#/!UytJQHLQYfvYWsGrGY:jki.re/$12bTUiObDFdHLAYtT7E-BvYRp3k_xv8w0dUQHibasJk?via=jki.re&via=matrix.org * Make it possible to get the room_version with txn * Allow but ignore historical events in unsupported room version See https://github.com/matrix-org/synapse/pull/10245#discussion_r675592489 We can't reject historical events on unsupported room versions because homeservers without knowledge of MSC2716 or the new room version don't reject historical events either. Since we can't rely on the auth check here to stop historical events on unsupported room versions, I've added some additional checks in the processing/persisting code (`synapse/storage/databases/main/events.py` -> `_handle_insertion_event` and `_handle_chunk_event`). I've had to do some refactoring so there is method to fetch the room version by `txn`. * Move to unique index syntax See https://github.com/matrix-org/synapse/pull/10245#discussion_r675638509 * High-level document how the insertion->chunk lookup works * Remove create_event fallback for room_versions See https://github.com/matrix-org/synapse/pull/10245/files#r677641879 * Use updated method name
* Reduce likelihood of Postgres table scanning `state_groups_state`. (#10359)Erik Johnston2021-07-151-0/+34
| | | | | | | | The postgres statistics collector sometimes massively underestimates the number of distinct state groups are in the `state_groups_state`, which can cause postgres to use table scans for queries for multiple state groups. We fix this by manually setting `n_distinct` on the column.
* Replace `room_depth.min_depth` with a BIGINT (#10289)Richard van der Hoff2021-07-122-0/+88
| | | | | while I'm dealing with INTEGERs and BIGINTs, let's replace room_depth.min_depth with a BIGINT.
* Switch `application_services_txns.txn_id` to BIGINT (#10349)Richard van der Hoff2021-07-091-0/+23
|
* Remove functionality associated with unused historical stats tables (#9721)Cristina2021-07-081-1/+5
| | | Fixes #9602
* fix ordering of bg update (#10291)Richard van der Hoff2021-07-011-1/+1
| | | | | this was a typo introduced in #10282. We don't want to end up doing the `replace_stream_ordering_column` update after anything that comes up in migration 60/03.
* Change more stream_ordering columns to BIGINT (#10286)Richard van der Hoff2021-06-301-0/+30
|
* Rebuild other indexes using `stream_ordering` (#10282)Richard van der Hoff2021-06-301-3/+8
| | | | We need to rebuild *all* of the indexes that use the current `stream_ordering` column.
* Merge branch 'release-v1.37' into developRichard van der Hoff2021-06-292-0/+69
|\
| * Handle inbound events from federation asynchronously (#10272)Erik Johnston2021-06-291-0/+32
| | | | | | | | | | | | | | | | | | | | | | Fixes #9490 This will break a couple of SyTest that are expecting failures to be added to the response of a federation /send, which obviously doesn't happen now that things are asynchronous. Two drawbacks: Currently there is no logic to handle any events left in the staging area after restart, and so they'll only be handled on the next incoming event in that room. That can be fixed separately. We now only process one event per room at a time. This can be fixed up further down the line.
| * Add a distributed lock (#10269)Erik Johnston2021-06-291-0/+37
| | | | | | This adds a simple best effort locking mechanism that works cross workers.
* | Migrate stream_ordering to a bigint (#10264)Richard van der Hoff2021-06-292-1/+41
| | | | | | | | | | | | | | | | | | | | * Move background update names out to a separate class `EventsBackgroundUpdatesStore` gets inherited and we don't really want to further pollute the namespace. * Migrate stream_ordering to a bigint * changelog
* | MSC2918 Refresh tokens implementation (#9450)Quentin Gliech2021-06-241-0/+34
|/ | | | | | | | | | This implements refresh tokens, as defined by MSC2918 This MSC has been implemented client side in Hydrogen Web: vector-im/hydrogen-web#235 The basics of the MSC works: requesting refresh tokens on login, having the access tokens expire, and using the refresh token to get a new one. Signed-off-by: Quentin Gliech <quentingliech@gmail.com>
* Fix schema delta to not take as long on large servers (#10227)Erik Johnston2021-06-221-2/+5
| | | Introduced in #6739
* Support for database schema version ranges (#9933)Richard van der Hoff2021-06-113-37/+26
| | | This is essentially an implementation of the proposal made at https://hackmd.io/@richvdh/BJYXQMQHO, though the details have ended up looking slightly different.
* Implement knock feature (#6739)Sorunome2021-06-091-0/+17
| | | | | | This PR aims to implement the knock feature as proposed in https://github.com/matrix-org/matrix-doc/pull/2403 Signed-off-by: Sorunome mail@sorunome.de Signed-off-by: Andrew Morgan andrewm@element.io
* Use a database table to hold the users that should have full presence sent ↵Andrew Morgan2021-05-181-0/+34
| | | | to them, instead of something in-memory (#9823)
* Reorganise the database schema directories (#9932)Richard van der Hoff2021-05-07280-0/+10293
| | | | | The hope here is that by moving all the schema files into synapse/storage/schema, it gets a bit easier for newcomers to navigate. It certainly got easier for me to write a helpful README. There's more to do on that front, but I'll follow up with other PRs for that.
* Only run one background update at a timeRichard van der Hoff2020-03-311-0/+19
|
* Move schema delta files to the correct data store.Erik Johnston2019-10-242-73/+0
| | | | They were put in the global schema delta directory due to a bad merge.
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-10-222-0/+73
|\ | | | | | | erikj/refactor_stores
| * Merge branch 'develop' into uhoreg/e2e_cross-signing_mergedHubert Chathi2019-10-189-0/+221
| |\
| * \ Merge branch 'develop' into cross-signing_keysHubert Chathi2019-09-041-0/+152
| |\ \
| * \ \ Merge branch 'uhoreg/e2e_cross-signing_merged' into cross-signing_keysHubert Chathi2019-08-284-0/+75
| |\ \ \
| | * \ \ Merge branch 'develop' into uhoreg/e2e_cross-signing_mergedHubert Chathi2019-08-284-0/+75
| | |\ \ \
| | * | | | Cross-signing [1/4] -- hidden devices (#5759)Hubert Chathi2019-08-121-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * allow devices to be marked as "hidden" This is a prerequisite for cross-signing, as it allows us to create other things that live within the device namespace, so they can be used for signatures.
| * | | | | use stream ID generator instead of timestampHubert Chathi2019-08-281-3/+3
| | | | | |
| * | | | | make changes from PR reviewHubert Chathi2019-08-012-41/+55
| | | | | |
| * | | | | Merge branch 'cross-signing_hidden' into cross-signing_keysHubert Chathi2019-08-013-3/+42
| |\ \ \ \ \
| | * | | | | Merge branch 'develop' into cross-signing_hiddenHubert Chathi2019-07-303-3/+42
| | |\| | | |
| * | | | | | Merge branch 'cross-signing_hidden' into cross-signing_keysHubert Chathi2019-07-301-1/+1
| |\| | | | |
| | * | | | | apply changes from PR reviewHubert Chathi2019-07-301-1/+1
| | | | | | |
| * | | | | | allow uploading keys for cross-signingHubert Chathi2019-07-251-0/+41
| |/ / / / /
| * | | | | allow devices to be marked as "hidden"Hubert Chathi2019-07-241-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a prerequisite for cross-signing, as it allows us to create other things that live within the device namespace, so they can be used for signatures.
* | | | | | Move storage classes into a main "data store".Erik Johnston2019-10-21189-8109/+10
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | This is in preparation for having multiple data stores that offer different functionality, e.g. splitting out state or event storage.
* | | | | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-10-103-0/+88
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | erikj/disable_sql_bytes
| * | | | | Rewrite the user_filter migration again (#6184)Richard van der Hoff2019-10-101-26/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | you can't plausibly ALTER TABLE in sqlite, so we create the new table with the right schema to start with.
| * | | | | Merge pull request #6185 from matrix-org/erikj/fix_censored_evnetsErik Johnston2019-10-091-0/+26
| |\ \ \ \ \ | | | | | | | | | | | | | | Fix inserting bytes as text in `censor_redactions`
| * | | | | | Fix unique_user_filter_index schema updateBrendan Abolivier2019-10-071-2/+2
| | | | | | |
| * | | | | | Update `user_filters` table to have a unique index, and non-null columns (#1172)Alexander Maznev2019-10-041-0/+46
| | | | | | |
| * | | | | | Land improved room list based on room stats (#6019)Erik Johnston2019-10-021-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use room_stats and room_state for room directory search
| * | | | | | Merge branch 'release-v1.4.0' of github.com:matrix-org/synapse into developErik Johnston2019-10-022-0/+38
| |\ \ \ \ \ \
| * | | | | | | Drop unused tables (#6115)Richard van der Hoff2019-09-301-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These tables are unused since #5893 (as amended by #6047), so we can now drop them. Fixes #6048.
* | | | | | | | Do the update as a background indexErik Johnston2019-10-091-9/+8
| |_|/ / / / / |/| | | | | |
* | | | | | | Fix existing hex encoded json values in DBErik Johnston2019-10-081-0/+26
| |/ / / / / |/| | | | |
* | | | | | Fix errors storing large retry intervals.Erik Johnston2019-10-021-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have set the max retry interval to a value larger than a postgres or sqlite int can hold, which caused exceptions when updating the destinations table. To fix postgres we need to change the column to a bigint, and for sqlite we lower the max interval to 2**62 (which is still incredibly long).
* | | | | | Add received_ts column to redactions.Erik Johnston2019-10-011-0/+20
|/ / / / / | | | | | | | | | | | | | | | | | | | | This will allow us to efficiently search for uncensored redactions in the DB before a given time.
* | | | | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-09-251-0/+24
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | erikj/cleanup_user_ips
| * \ \ \ \ Merge remote-tracking branch 'origin/develop' into rav/saml_mapping_workRichard van der Hoff2019-09-241-20/+0
| |\ \ \ \ \
| * \ \ \ \ \ Merge branch 'develop' into rav/saml_mapping_workRichard van der Hoff2019-09-197-0/+269
| |\ \ \ \ \ \
| * | | | | | | Record mappings from saml users in an external tableRichard van der Hoff2019-09-131-0/+24
| | |_|_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to assign unique mxids to saml users based on an incrementing suffix. For that to work, we need to record the allocated mxid in a separate table.
* | | | | | | Add BG update to populate devices last seen infoErik Johnston2019-09-231-0/+3
| | | | | | |
* | | | | | | Add last seen info to devices table.Erik Johnston2019-09-231-0/+21
| |_|/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | This allows us to purge old user_ips entries without having to preserve the latest last seen info for active devices.
* | | | | | Undo the deletion of some tables (#6047)Richard van der Hoff2019-09-191-20/+0
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a partial revert of #5893. The problem is that if we drop these tables in the same release as removing the code that writes to them, it prevents users users from being able to roll back to a previous release. So let's leave the tables in place for now, and remember to drop them in a subsequent release. (Note that these tables haven't been *read* for *years*, so any missing rows resulting from a temporary upgrade to vNext won't cause a problem.)
* | | | | Add 'failure_ts' column to 'destinations' table (#6016)Richard van der Hoff2019-09-171-0/+25
| | | | | | | | | | | | | | | | | | | | Track the time that a server started failing at, for general analysis purposes.
* | | | | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-09-051-0/+152
|\ \ \ \ \ | | |_|_|/ | |/| | | | | | | | erikj/censor_redactions
| * | | | Fix and refactor room and user stats (#5971)Erik Johnston2019-09-041-0/+152
| | |_|/ | |/| | | | | | Previously the stats were not being correctly populated.
* / | | Censor redactions in DB after a monthErik Johnston2019-08-301-0/+17
|/ / /
* | | Propagate opentracing contexts through EDUs (#5852)Jorik Schellekens2019-08-221-0/+20
| | | | | | | | | | | | | | | Propagate opentracing contexts through EDUs Co-Authored-By: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* | | Add missing index on users_in_public_rooms. (#5894)Richard van der Hoff2019-08-221-0/+17
| | |
* | | Drop some unused tables. (#5893)Richard van der Hoff2019-08-211-0/+20
| | | | | | | | | These tables are never used, so we may as well drop them.
* | | add the version field to the index for e2e_room_keysHubert Chathi2019-08-141-0/+18
|/ /
* | Don't recreate columnErik Johnston2019-07-302-1/+22
| |
* | Fix current_state_events membership background update.Erik Johnston2019-07-301-0/+0
| | | | | | | | | | | | Turns out not all rooms are in `rooms`, so lets fetch the room list from `current_state_events`. We move the delta file to force it to be run again.
* | Remove lost commentErik Johnston2019-07-291-7/+0
| |
* | Add function to get all forgotten rooms for userErik Johnston2019-07-241-0/+25
|/ | | | | | This will allow us to efficiently filter out rooms that have been forgotten in other queries without having to join against the `room_memberships` table.
* Update comment for new columnErik Johnston2019-07-191-0/+3
|
* Add background update for current_state_events.membership columnErik Johnston2019-07-181-0/+3
|
* Add membership column to current_state_events table.Erik Johnston2019-07-181-0/+19
| | | | | It turns out that doing a join is surprisingly expensive for the DB to do when room_membership table is larger than the disk cache.
* Implement access token expiry (#5660)Richard van der Hoff2019-07-121-0/+18
| | | | Record how long an access token is valid for, and raise a soft-logout once it expires.
* Run Black. (#5482)Amber Brown2019-06-207-38/+58
|
* Track deactivated accounts in the database (#5378)Brendan Abolivier2019-06-141-0/+19
|
* Merge pull request #5320 from matrix-org/hawkowl/full-schema-v1Erik Johnston2019-06-064-0/+2338
|\ | | | | Make a full SQL schema
| * fix maybeAmber H. Brown2019-06-071-20/+2
| |
| * just user dir?Amber H. Brown2019-06-071-1/+19
| |
| * remove background updates that arent neededAmber H. Brown2019-06-071-33/+1
| |
| * add more commentsAmber Brown2019-06-061-0/+5
| |
| * add stuff in bg updatesAmber Brown2019-06-041-10/+62
| |
| * WHY IS THIS CALLED A SLIGHTLY DIFFERENT THINGAmber Brown2019-06-031-0/+1
| |
| * more fixAmber Brown2019-06-031-0/+38
| |
| * fix schemasAmber Brown2019-06-033-59/+18
| |
| * full schemaAmber Brown2019-06-033-0/+2315
| |
* | Add ability to perform password reset via email without trusting the ↵Andrew Morgan2019-06-061-0/+31
|/ | | | | | | | | | | | identity server (#5377) Sends password reset emails from the homeserver instead of proxying to the identity server. This is now the default behaviour for security reasons. If you wish to continue proxying password reset requests to the identity server you must now enable the email.trust_identity_server_for_password_resets option. This PR is a culmination of 3 smaller PRs which have each been separately reviewed: * #5308 * #5345 * #5368
* Merge pull request #5294 from matrix-org/erikj/speed_up_room_statsErik Johnston2019-05-311-0/+28
|\ | | | | Speed up room stats background update
| * Add indices. Remove room_ids accidentally addedErik Johnston2019-05-311-0/+28
| | | | | | | | | | | | | | | | | | | | We have to do this by re-inserting a background update and recreating tables, as the tables only get created during a background update and will later be deleted. We also make sure that we remove any entries that should have been removed but weren't due to a race that has been fixed in a previous commit.
* | Add index to temp tableErik Johnston2019-05-301-0/+1
|/
* Fixup comments and loggingErik Johnston2019-05-301-0/+3
|
* Add DB bg update to cleanup extremities.Erik Johnston2019-05-291-0/+19
| | | | | Due to #5269 we may have extremities in our DB that we shouldn't have, so lets add a cleanup task such to remove those.
* Merge pull request #5268 from matrix-org/babolivier/account_validity_fix_schemaBrendan Abolivier2019-05-281-0/+3
|\ | | | | Fix schema update for account validity
| * Fix schema update for account validityBrendan Abolivier2019-05-281-0/+3
| |
* | Store key validity time in the storage layerRichard van der Hoff2019-05-231-0/+23
| | | | | | | | | | | | | | | | This is a first step to checking that the key is valid at the required moment. The idea here is that, rather than passing VerifyKey objects in and out of the storage layer, we instead pass FetchKeyResult objects, which simply wrap the VerifyKey and add a valid_until_ts field.
* | Room Statistics (#4338)Amber Brown2019-05-211-0/+80
| |
* | Add simple send_relation API and track in DBErik Johnston2019-05-151-0/+27
|/
* Merge pull request #5047 from matrix-org/babolivier/account_expirationBrendan Abolivier2019-04-171-1/+8
|\ | | | | Send out emails with links to extend an account's validity period
| * Send out emails with links to extend an account's validity periodBrendan Abolivier2019-04-171-1/+8
| |
* | Merge pull request #5033 from matrix-org/erikj/fix_schema_deltaErik Johnston2019-04-101-1/+3
|\ \ | | | | | | Fix schema upgrade when dropping tables
| * | Fix schema upgrade when dropping tablesErik Johnston2019-04-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | We need to drop tables in the correct order due to foreign table constraints (on `application_services`), otherwise the DROP TABLE command will fail. Introduced in #4992.
* | | Merge pull request #5027 from matrix-org/babolivier/account_expirationBrendan Abolivier2019-04-091-0/+20
|\ \ \ | |/ / |/| / | |/ Add time-based account expiration
| * Add account expiration featureBrendan Abolivier2019-04-091-0/+20
| |
* | Remove unused server_tls_certificates functions (#5028)Richard van der Hoff2019-04-082-11/+4
| | | | | | | | These have been unused since #4120, and with the demise of perspectives, it is unlikely that they will ever be used again.
* | drop tables listed in #1830 (#4992)Neil Johnson2019-04-0823-740/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tables dropped: * application_services, * application_services_regex, * transaction_id_to_pdu, * stats_reporting * current_state_resets * event_content_hashes * event_destinations * event_edge_hashes * event_signatures * feedback * room_hosts * state_forward_extremities
* | Remove presence lists (#4989)Neil Johnson2019-04-032-10/+18
| | | | | | Remove presence list support as per MSC 1819
* | Fixup docstringsErik Johnston2019-04-021-2/+2
| |
* | Grandfather in existing user threepidsErik Johnston2019-04-011-0/+2
| | | | | | | | | | | | We assume, as we did before, that users bound their threepid to one of the trusted identity servers. So we simply fill the new table with all threepids in `user_threepids` joined with the trusted identity servers.
* | Track IS used to bind 3PIDsErik Johnston2019-04-011-0/+27
|/ | | | | This will then be used to know which IS to default to when unbinding the threepid.
* Fix user directory background update (#4887)Erik Johnston2019-03-191-1/+1
|
* Migrate the user directory initial population to a background task (#4864)Amber Brown2019-03-191-0/+30
|
* fixupAmber Brown2019-03-131-7/+0
|
* fixupAmber Brown2019-03-121-5/+12
|
* Merge remote-tracking branch 'origin/develop' into hawkowl/userdir-searchAmber Brown2019-03-111-0/+2
|\
| * Add comment to schemaErik Johnston2019-03-081-0/+2
| |
* | initialAmber Brown2019-03-112-3/+28
|/
* Rewrite userdir to be faster (#4537)Amber Brown2019-03-071-0/+47
|
* Analyze user_ips before running deduplicationErik Johnston2019-02-121-3/+7
| | | | | | | Due to the table locks taken out by the naive upsert, the table statistics may be out of date. During deduplication it is important that the correct index is used as otherwise a full table scan may be incorrectly used, which can end up thrashing the database badly.
* Add support for persisting event format versionsErik Johnston2019-01-231-0/+16
| | | | | | | | | | | | | | Currently we only have the one event format version defined, but this adds the necessary infrastructure to persist and fetch the format versions alongside the events. We specify the format version rather than the room version as: 1. We don't necessarily know the room version, existing events may be either v1 or v2. 2. We'd need to be careful to prevent/handle correctly if different events in the same room reported to be of different versions, which sounds annoying.
* Remove duplicates in the user_ips table and add an index (#4370)Amber Brown2019-01-121-0/+26
|
* create support user (#4141)Neil Johnson2018-12-141-0/+19
| | | | | | Allow for the creation of a support user. A support user can access the server, join rooms, interact with other users, but does not appear in the user directory nor does it contribute to monthly active user limits.
* Drop sent_transactionsAaron Raimist2018-12-014-72/+2
| | | | Signed-off-by: Aaron Raimist <aaron@raim.ist>
* Merge remote-tracking branch 'origin/develop' into ↵David Baker2018-11-093-4/+60
|\ | | | | | | dbkr/e2e_backup_versions_are_numbers
| * Add unique indexes to a couple of tablesRichard van der Hoff2018-11-022-4/+41
| | | | | | | | | | The indexes on device_lists_remote_extremeties can be unique, and they therefore should, to ensure that the db remains consistent.
| * Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-10-191-0/+39
| |\ | | | | | | | | | erikj/purge_state_groups
| * | Add state_group index to event_to_state_groupsErik Johnston2018-10-041-0/+19
| | | | | | | | | | | | | | | This is needed to efficiently check for unreferenced state groups during purge.
* | | Try & make it work on postgresDavid Baker2018-10-301-2/+2
| | |
* | | Make e2e backup versions numeric in the DBDavid Baker2018-10-291-0/+53
| |/ |/| | | | | | | We were doing max(version) which does not do what we wanted on a column of type TEXT.
* | Don't reuse backup versionsDavid Baker2018-10-051-1/+2
| | | | | | | | | | | | | | | | Since we don't actually delete the keys, just mark the versions as deleted in the db rather than actually deleting them, then we won't reuse versions. Fixes https://github.com/vector-im/riot-web/issues/7448
* | WIP e2e key backupsDavid Baker2018-09-131-0/+0
| | | | | | | | | | | | | | Continues from uhoreg's branch This just fixed the errcode on /room_keys/version if no backup and updates the schema delta to be on the latest so it gets run
* | Merge branch 'develop' into e2e_backupsHubert Chathi2018-08-241-0/+27
|\|
| * typosNeil Johnson2018-08-081-1/+1
| |
| * make use of _simple_select_one_onecol, improved commentsNeil Johnson2018-08-061-0/+4
| |
| * Revert "change monthly_active_users table to be a single column"Neil Johnson2018-08-021-1/+3
| | | | | | | | This reverts commit ec716a35b219d147dee51733b55573952799a549.
| * change monthly_active_users table to be a single columnNeil Johnson2018-08-011-3/+1
| |
| * fix commentNeil Johnson2018-08-011-1/+1
| |
| * api into monthly_active_users tableNeil Johnson2018-07-312-1/+24
| |
* | fix idiocies and so make tests passMatthew Hodgson2018-08-121-1/+1
| |
* | blindly incorporate PR review - needs testing & fixingMatthew Hodgson2018-08-121-5/+3
| |
* | make /room_keys/version workMatthew Hodgson2018-08-121-2/+2
| |
* | implement /room_keys/version too (untested)Matthew Hodgson2018-08-121-1/+1
| |
* | make it work and fix pep8Matthew Hodgson2018-08-121-1/+1
| |
* | total WIP skeleton for /room_keys APIMatthew Hodgson2018-08-121-0/+40
| |
* | coding styleNeil Johnson2018-07-311-1/+1
|/
* Create the column nullableRichard van der Hoff2018-07-262-9/+13
| | | | | There's no real point in ever making the column non-nullable, and doing so breaks the sytests.
* Stop populating events.contentRichard van der Hoff2018-07-261-0/+93
| | | | | | This field is no longer read from, so we should stop populating it. Once we're happy that this doesn't break everything, and a rollback is unlikely, we can think about dropping the column.
* comment on event_edgesRichard van der Hoff2018-07-261-1/+2
|
* run isortAmber Brown2018-07-0911-23/+24
|
* Revert "Revert "Merge pull request #3431 from ↵Erik Johnston2018-06-251-0/+21
| | | | | | matrix-org/rav/erasure_visibility"" This reverts commit 1d009013b3c3e814177afc59f066e02a202b21cd.
* Revert "Merge pull request #3431 from matrix-org/rav/erasure_visibility"Richard van der Hoff2018-06-221-21/+0
| | | | | This reverts commit ce0d911156b355c5bf452120bfb08653dad96497, reversing changes made to b4a5d767a94f1680d07edfd583aae54ce422573e.
* UserErasureStoreRichard van der Hoff2018-06-121-0/+21
| | | | to store which users have been erased
* remove unnecessary INSERTNeil Johnson2018-06-011-1/+0
|
* create users index on creation_tsNeil Johnson2018-05-291-0/+20
|
* Send users a server notice about consentRichard van der Hoff2018-05-221-0/+20
| | | | | When a user first syncs, we will send them a server notice asking them to consent to the privacy policy if they have not already done so.
* Merge pull request #3163 from matrix-org/cohort_analyticsNeil Johnson2018-05-162-0/+38
|\ | | | | user visit data
| * Merge branch 'develop' of https://github.com/matrix-org/synapse into ↵Neil Johnson2018-05-142-1/+60
| |\ | | | | | | | | | cohort_analytics
| * | add inidexes based on usageNeil Johnson2018-05-011-6/+2
| | |
| * | Generate user daily statsNeil Johnson2018-04-252-0/+42
| | |
* | | Merge pull request #3213 from matrix-org/rav/consent_handlerRichard van der Hoff2018-05-161-0/+18
|\ \ \ | | | | | | | | ConsentResource to gather policy consent from users
| * | | ConsentResource to gather policy consent from usersRichard van der Hoff2018-05-151-0/+18
| | |/ | |/| | | | | | | | | | Hopefully there are enough comments and docs in this that it makes sense on its own.
* / | Add the schema fileDavid Baker2018-05-091-0/+25
|/ /
* | Merge pull request #3129 from matrix-org/matthew/fix_group_dupsMatthew Hodgson2018-04-301-0/+57
|\ \ | | | | | | remove duplicates from groups tables
| * | fix missing importMatthew Hodgson2018-04-281-0/+1
| | |
| * | pep8Matthew Hodgson2018-04-281-3/+5
| | |
| * | make it work with sqliteMatthew Hodgson2018-04-282-34/+54
| | |
| * | remove duplicates from groups tablesMatthew Hodgson2018-04-251-0/+34
| |/ | | | | | | | | and rename inconsistently named indexes. Based on https://github.com/matrix-org/synapse/pull/3128 - thanks @vurpo\!
* / Move more xrange to sixAdrian Tschira2018-04-281-1/+3
|/ | | | | | plus a bonus next() Signed-off-by: Adrian Tschira <nota@notafile.com>
* Merge pull request #3045 from matrix-org/dbkr/group_joinableLuke Barnard2018-04-051-0/+22
|\ | | | | Add joinability for groups
| * NON NULL -> NOT NULLLuke Barnard2018-04-051-1/+1
| |
| * Use DEFAULT join_policy of "invite" in dbLuke Barnard2018-04-051-1/+1
| |
| * Use join_policy API instead of joinableLuke Barnard2018-04-031-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The API is now under /groups/$group_id/setting/m.join_policy and expects a JSON blob of the shape ```json { "m.join_policy": { "type": "invite" } } ``` where "invite" could alternatively be "open".
| * OK, smallint it is thenDavid Baker2018-03-281-1/+1
| |
| * Grr. Copy the definition from is_adminDavid Baker2018-03-281-1/+1
| |
| * Make column definition that works on both dbsDavid Baker2018-03-281-1/+1
| |
| * Add schema delta fileDavid Baker2018-03-281-0/+16
| |
* | Merge pull request #3041 from matrix-org/r30_statsNeil Johnson2018-04-051-0/+17
|\ \ | | | | | | R30 stats
| * | Add user_ips last seen indexNeil Johnson2018-03-281-0/+17
| |/
* / Use simplejson throughoutRichard van der Hoff2018-03-291-1/+2
|/ | | | Let's use simplejson rather than json, for consistency.
* Merge branch 'master' of github.com:matrix-org/synapse into developErik Johnston2018-03-194-8/+8
|\