Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Snapshot schema 72 #13873

Merged
merged 10 commits into from
Sep 26, 2022
Merged

Snapshot schema 72 #13873

merged 10 commits into from
Sep 26, 2022

Conversation

DMRobertson
Copy link
Contributor

@DMRobertson DMRobertson commented Sep 22, 2022

Now that

SCHEMA_VERSION = 73 # remember to update the list below when updating

we can snapshot the database featuring all migrations in version <= 72. See commit-by-commit for how this is done. Had to make a few tweaks to

  • the way that we ingest SQL. Our home grown SQL parser doesn't seem to understand postgres' dollar quotes.
  • the schema dump script. There were some oddities in the sqlite output which only occur under .schema --indent. Easiest to drop the pretty printing :( We were also dropping some SELECT statements with side effects that we shouldn't have been.

Closes #13715.

@DMRobertson DMRobertson force-pushed the dmr/snapshot branch 4 times, most recently from c603243 to 9c9121f Compare September 22, 2022 18:03
@@ -120,6 +120,25 @@ def attempt_to_set_isolation_level(
# All transactions are SERIALIZABLE by default in sqlite
pass

@staticmethod
def executescript(cursor: sqlite3.Cursor, script: str) -> None:
Copy link
Contributor Author

@DMRobertson DMRobertson Sep 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a lie, because the cursor is actually a LoggingTransaction that wraps a sqlite3.Cursor.

I restrained myself from making further type annotations here.

@DMRobertson DMRobertson force-pushed the dmr/snapshot branch 3 times, most recently from f6f8786 to 3f2fff1 Compare September 22, 2022 19:53
@DMRobertson DMRobertson marked this pull request as ready for review September 22, 2022 21:18
@DMRobertson DMRobertson requested a review from a team as a code owner September 22, 2022 21:18
@DMRobertson

This comment was marked as outdated.

David Robertson added 10 commits September 23, 2022 13:54
So we can feed in a big SQL file to sql and sqlite without having to
worry about parsing it. Motivation: our handwritten sort=of-parser
doesn't like the CREATE TRIGGER statements (or at least the quoting it
uses) in the upcoming schema dump.

Irritatingly the `cursor` that the DB engines get isn't a raw cursor but
a `LoggingTransaction`. That is, the annotations I wrote on the DB
engine are wrong. Maybe we can make `LoggingTransaction` generic over a
cursor type in the future.
`--indent` is prettier, but it seems to cause SQLite to produce duff
output when processing single quotes in comments.
Because these can alter the next `nextval`.
Postgres 11 introduces uses the syntax `CREATE FUNCTION` in a trigger
definition, and uses that syntax when invoking `pg_dump`. But Postgres
10 doesn't recognise this and needs the spelling `CREATE PROCEDURE`.
So they don't end up in full schema 72
```shell
docker run --rm -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=synapse -p 5432:5432 postgres:10-alpine
echo postgres | scripts-dev/make_full_schema.sh -p synapse_user -n 72 -o synapse/storage/schema
```
@erikjohnston
Copy link
Member

Out of interest have you tried comparing a pg_dump comparing before and after this?

@DMRobertson
Copy link
Contributor Author

Out of interest have you tried comparing a pg_dump comparing before and after this?

Erm, no, but I can do.

Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If its easy to check if the pg_dump before/after matches then I think its worth doing for paranoia's sake, otherwise LGTM!

@DMRobertson
Copy link
Contributor Author

If its easy to check if the pg_dump before/after matches then I think its worth doing for paranoia's sake, otherwise LGTM!

The diff isn't very interesting:

$ diff -u synapse_{migrated,snapshot}.sql
--- synapse_migrated.sql	2022-09-26 17:44:51.297133350 +0100
+++ synapse_snapshot.sql	2022-09-26 17:39:25.482251022 +0100
@@ -2351,163 +2351,6 @@
 --
 
 COPY public.applied_schema_deltas (version, file) FROM stdin;
-55	55/access_token_expiry.sql
-55	55/track_threepid_validations.sql
-55	55/users_alter_deactivated.sql
-56	56/add_spans_to_device_lists.sql
-56	56/current_state_events_membership.sql
-56	56/current_state_events_membership_mk2.sql
-56	56/delete_keys_from_deleted_backups.sql
-56	56/destinations_failure_ts.sql
-56	56/destinations_retry_interval_type.sql.postgres
-56	56/device_stream_id_insert.sql
-56	56/devices_last_seen.sql
-56	56/drop_unused_event_tables.sql
-56	56/event_expiry.sql
-56	56/event_labels.sql
-56	56/event_labels_background_update.sql
-56	56/fix_room_keys_index.sql
-56	56/hidden_devices.sql
-56	56/nuke_empty_communities_from_db.sql
-56	56/public_room_list_idx.sql
-56	56/redaction_censor.sql
-56	56/redaction_censor2.sql
-56	56/redaction_censor3_fix_update.sql.postgres
-56	56/redaction_censor4.sql
-56	56/remove_tombstoned_rooms_from_directory.sql
-56	56/room_key_etag.sql
-56	56/room_membership_idx.sql
-56	56/room_retention.sql
-56	56/signing_keys.sql
-56	56/signing_keys_nonunique_signatures.sql
-56	56/state_group_room_idx.sql
-56	56/stats_separated.sql
-56	56/unique_user_filter_index.py
-56	56/user_external_ids.sql
-56	56/users_in_public_rooms_idx.sql
-57	57/delete_old_current_state_events.sql
-57	57/device_list_remote_cache_stale.sql
-57	57/local_current_membership.py
-57	57/remove_sent_outbound_pokes.sql
-57	57/rooms_version_column.sql
-57	57/rooms_version_column_2.sql.postgres
-57	57/rooms_version_column_3.sql.postgres
-58	58/00background_update_ordering.sql
-58	58/02remove_dup_outbound_pokes.sql
-58	58/03persist_ui_auth.sql
-58	58/05cache_instance.sql.postgres
-58	58/06dlols_unique_idx.py
-58	58/07add_method_to_thumbnail_constraint.sql.postgres
-58	58/07persist_ui_auth_ips.sql
-58	58/08_media_safe_from_quarantine.sql.postgres
-58	58/09shadow_ban.sql
-58	58/10_pushrules_enabled_delete_obsolete.sql
-58	58/10drop_local_rejections_stream.sql
-58	58/10federation_pos_instance_name.sql
-58	58/11dehydration.sql
-58	58/11fallback.sql
-58	58/11user_id_seq.py
-58	58/12room_stats.sql
-58	58/13remove_presence_allow_inbound.sql
-58	58/14events_instance_name.sql
-58	58/14events_instance_name.sql.postgres
-58	58/15_catchup_destination_rooms.sql
-58	58/15unread_count.sql
-58	58/16populate_stats_process_rooms_fix.sql
-58	58/17_catchup_last_successful.sql
-58	58/18stream_positions.sql
-58	58/19instance_map.sql.postgres
-58	58/19txn_id.sql
-58	58/20instance_name_event_tables.sql
-58	58/20user_daily_visits.sql
-58	58/21as_device_stream.sql
-58	58/21drop_device_max_stream_id.sql
-58	58/22puppet_token.sql
-58	58/22users_have_local_media.sql
-58	58/23e2e_cross_signing_keys_idx.sql
-58	58/24drop_event_json_index.sql
-58	58/25user_external_ids_user_id_idx.sql
-58	58/26access_token_last_validated.sql
-58	58/27local_invites.sql
-58	58/28drop_last_used_column.sql.postgres
-59	59/01ignored_user.py
-59	59/02shard_send_to_device.sql
-59	59/03shard_send_to_device_sequence.sql.postgres
-59	59/04_event_auth_chains.sql
-59	59/04_event_auth_chains.sql.postgres
-59	59/04drop_account_data.sql
-59	59/05cache_invalidation.sql
-59	59/06chain_cover_index.sql
-59	59/06shard_account_data.sql
-59	59/06shard_account_data.sql.postgres
-59	59/07shard_account_data_fix.sql
-59	59/08delete_pushers_for_deactivated_accounts.sql
-59	59/08delete_stale_pushers.sql
-59	59/09rejected_events_metadata.sql
-59	59/10delete_purged_chain_cover.sql
-59	59/11add_knock_members_to_stats.sql
-59	59/11drop_thumbnail_constraint.sql.postgres
-59	59/12account_validity_token_used_ts_ms.sql
-59	59/12presence_stream_instance.sql
-59	59/12presence_stream_instance_seq.sql.postgres
-59	59/13users_to_send_full_presence_to.sql
-59	59/14refresh_tokens.sql
-59	59/15locks.sql
-59	59/16federation_inbound_staging.sql
-60	60/01recreate_stream_ordering.sql.postgres
-60	60/02change_stream_ordering_columns.sql.postgres
-61	61/01change_appservices_txns.sql.postgres
-61	61/01insertion_event_lookups.sql
-61	61/02drop_redundant_room_depth_index.sql
-61	61/02state_groups_state_n_distinct.sql.postgres
-61	61/03recreate_min_depth.py
-62	62/01insertion_event_extremities.sql
-63	63/01create_registration_tokens.sql
-63	63/02delete_unlinked_email_pushers.sql
-63	63/02populate-rooms-creator.sql
-63	63/03session_store.sql
-63	63/04add_presence_stream_not_offline_index.sql
-64	64/01msc2716_chunk_to_batch_rename.sql.postgres
-65	65/01msc2716_insertion_event_edges.sql
-65	65/03remove_hidden_devices_from_device_inbox.sql
-65	65/04_local_group_updates.sql
-65	65/05_remove_room_stats_historical_and_user_stats_historical.sql
-65	65/06remove_deleted_devices_from_device_inbox.sql
-65	65/07_arbitrary_relations.sql
-65	65/08_device_inbox_background_updates.sql
-65	65/10_expirable_refresh_tokens.sql
-65	65/11_devices_auth_provider_session.sql
-67	67/01drop_public_room_list_stream.sql
-68	68/01event_columns.sql
-68	68/02_msc2409_add_device_id_appservice_stream_type.sql
-68	68/03_delete_account_data_for_deactivated_accounts.sql
-68	68/04_refresh_tokens_index_next_token_id.sql
-68	68/04partial_state_rooms.sql
-68	68/05partial_state_rooms_triggers.py
-68	68/06_msc3202_add_device_list_appservice_stream_type.sql
-69	69/01as_txn_seq.py
-69	69/01device_list_oubound_by_room.sql
-69	69/02cache_invalidation_index.sql
-70	70/01clean_table_purged_rooms.sql
-70	70/08_state_group_edges_unique.sql
-71	71/01rebuild_event_edges.sql.postgres
-71	71/01remove_noop_background_updates.sql
-71	71/02event_push_summary_unique.sql
-72	72/01add_room_type_to_state_stats.sql
-72	72/01event_push_summary_receipt.sql
-72	72/02event_push_actions_index.sql
-72	72/03bg_populate_events_columns.py
-72	72/03drop_event_reference_hashes.sql
-72	72/03remove_groups.sql
-72	72/04drop_column_application_services_state_last_txn.sql.postgres
-72	72/05receipts_event_stream_ordering.sql
-72	72/05remove_unstable_private_read_receipts.sql
-72	72/06add_consent_ts_to_users.sql
-72	72/06thread_notifications.sql
-72	72/07force_update_current_state_events_membership.py
-72	72/07thread_receipts.sql.postgres
-72	72/08begin_cache_invalidation_seq_at_2.sql.postgres
-72	72/08thread_receipts.sql
 \.

So I think this looks good?

Script
docker run --rm -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=synapse -p 5432:5432 postgres:10-alpine

rm -r synapse/storage/schema/main/delta/73

cat >/tmp/db.yaml <<EOF
server_name: "test"
signing_key_path: "/tmp/key"

macaroon_secret_key: "abcde"

report_stats: false

databases:
  postgres:
    name: "psycopg2"
    data_stores: ["main", "state"]
    args:
      user: "postgres"
      host: "127.0.0.1"
      password: postgres
      database: synapse_snapshot

# Suppress the key server warning.
trusted_key_servers: []
EOF


python -m synapse.app.homeserver --generate-keys -c /tmp/db.yaml
PGPASSWORD=postgres createdb -U postgres -h 127.0.0.1 --lc-collate=C --lc-ctype=C --template=template0 synapse_snapshot
update_synapse_database --run-background-updates --database-config db.yaml -v
PGPASSWORD=postgres pg_dump -h 127.0.0.1 -U postgres synapse_snapshot > synapse_snapshot.sql

rm -r synapse/storage/schema/{common,main,state}/full_schemas/72/
sed -i /tmp/db.yaml -e "s/database: synapse_snapshot/database: synapse_migrated/"
PGPASSWORD=postgres createdb -U postgres -h 127.0.0.1 --lc-collate=C --lc-ctype=C --template=template0 synapse_migrated
update_synapse_database --run-background-updates --database-config db.yaml -v
PGPASSWORD=postgres pg_dump -h 127.0.0.1 -U postgres synapse_migrated > synapse_migrated.sql

diff -u synapse_{migrated,snapshot}

@erikjohnston
Copy link
Member

Yup, I think that looks right

@DMRobertson DMRobertson merged commit 0a38c7e into develop Sep 26, 2022
@DMRobertson DMRobertson deleted the dmr/snapshot branch September 26, 2022 17:28
squahtx pushed a commit that referenced this pull request Oct 4, 2022
Synapse 1.69.0rc1 (2022-10-04)
==============================

Please note that legacy Prometheus metric names are now deprecated and will be removed in Synapse 1.73.0.
Server administrators should update their dashboards and alerting rules to avoid using the deprecated metric names.
See the [upgrade notes](https://matrix-org.github.io/synapse/v1.69/upgrade.html#upgrading-to-v1690) for more details.

Features
--------

- Allow application services to set the `origin_server_ts` of a state event by providing the query parameter `ts` in [`PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}`](https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3roomsroomidstateeventtypestatekey), per [MSC3316](matrix-org/matrix-spec-proposals#3316). Contributed by @lukasdenk. ([\#11866](#11866))
- Allow server admins to require a manual approval process before new accounts can be used (using [MSC3866](matrix-org/matrix-spec-proposals#3866)). ([\#13556](#13556))
- Exponentially backoff from backfilling the same event over and over. ([\#13635](#13635), [\#13936](#13936))
- Add cache invalidation across workers to module API. ([\#13667](#13667), [\#13947](#13947))
- Experimental implementation of [MSC3882](matrix-org/matrix-spec-proposals#3882) to allow an existing device/session to generate a login token for use on a new device/session. ([\#13722](#13722), [\#13868](#13868))
- Experimental support for thread-specific receipts ([MSC3771](matrix-org/matrix-spec-proposals#3771)). ([\#13782](#13782), [\#13893](#13893), [\#13932](#13932), [\#13937](#13937), [\#13939](#13939))
- Add experimental support for [MSC3881: Remotely toggle push notifications for another client](matrix-org/matrix-spec-proposals#3881). ([\#13799](#13799), [\#13831](#13831), [\#13860](#13860))
- Keep track when an event pulled over federation fails its signature check so we can intelligently back-off in the future. ([\#13815](#13815))
- Improve validation for the unspecced, internal-only `_matrix/client/unstable/add_threepid/msisdn/submit_token` endpoint. ([\#13832](#13832))
- Faster remote room joins: record _when_ we first partial-join to a room. ([\#13892](#13892))
- Support a `dir` parameter on the `/relations` endpoint per [MSC3715](matrix-org/matrix-spec-proposals#3715). ([\#13920](#13920))
- Ask mail servers receiving emails from Synapse to not send automatic replies (e.g. out-of-office responses). ([\#13957](#13957))

Bugfixes
--------

- Send push notifications for invites received over federation. ([\#13719](#13719), [\#14014](#14014))
- Fix a long-standing bug where typing events would be accepted from remote servers not present in a room. Also fix a bug where incoming typing events would cause other incoming events to get stuck during a fast join. ([\#13830](#13830))
- Fix a bug introduced in Synapse v1.53.0 where the experimental implementation of [MSC3715](matrix-org/matrix-spec-proposals#3715) would give incorrect results when paginating forward. ([\#13840](#13840))
- Fix access token leak to logs from proxy agent. ([\#13855](#13855))
- Fix `have_seen_event` cache not being invalidated after we persist an event which causes inefficiency effects like extra `/state` federation calls. ([\#13863](#13863))
- Faster room joins: Fix a bug introduced in 1.66.0 where an error would be logged when syncing after joining a room. ([\#13872](#13872))
- Fix a bug introduced in 1.66.0 where some required fields in the pushrules sent to clients were not present anymore. Contributed by Nico. ([\#13904](#13904))
- Fix packaging to include `Cargo.lock` in `sdist`. ([\#13909](#13909))
- Fix a long-standing bug where device updates could cause delays sending out to-device messages over federation. ([\#13922](#13922))
- Fix a bug introduced in v1.68.0 where Synapse would require `setuptools_rust` at runtime, even though the package is only required at build time. ([\#13952](#13952))
- Fix a long-standing bug where `POST /_matrix/client/v3/keys/query` requests could result in excessively large SQL queries. ([\#13956](#13956))
- Fix a performance regression in the `get_users_in_room` database query. Introduced in v1.67.0. ([\#13972](#13972))
- Fix a bug introduced in v1.68.0 bug where Rust extension wasn't built in `release` mode when using `poetry install`. ([\#14009](#14009))
- Do not return an unspecified `original_event` field when using the stable `/relations` endpoint. Introduced in Synapse v1.57.0. ([\#14025](#14025))
- Correctly handle a race with device lists when a remote user leaves during a partial join. ([\#13885](#13885))
- Correctly handle sending local device list updates to remote servers during a partial join. ([\#13934](#13934))

Improved Documentation
----------------------

- Add `worker_main_http_uri` for the worker generator bash script. ([\#13772](#13772))
- Update URL for the NixOS module for Synapse. ([\#13818](#13818))
- Fix a mistake in sso_mapping_providers.md: `map_user_attributes` is expected to return `display_name`, not `displayname`. ([\#13836](#13836))
- Fix a cross-link from the registration admin API to the `registration_shared_secret` configuration documentation. ([\#13870](#13870))
- Update the man page for the `hash_password` script to correct the default number of bcrypt rounds performed. ([\#13911](#13911), [\#13930](#13930))
- Emphasize the right reasons when to use `(room_id, event_id)` in a database schema. ([\#13915](#13915))
- Add instruction to contributing guide for running unit tests in parallel. Contributed by @ashfame. ([\#13928](#13928))
- Clarify that the `auto_join_rooms` config option can also be used with Space aliases. ([\#13931](#13931))
- Add some cross references to worker documentation. ([\#13974](#13974))
- Linkify urls in config documentation. ([\#14003](#14003))

Deprecations and Removals
-------------------------

- Remove the `complete_sso_login` method from the Module API which was deprecated in Synapse 1.13.0. ([\#13843](#13843))
- Announce that legacy metric names are deprecated, will be turned off by default in Synapse v1.71.0 and removed altogether in Synapse v1.73.0. See the upgrade notes for more information. ([\#14024](#14024))

Internal Changes
----------------

- Speed up creation of DM rooms. ([\#13487](#13487), [\#13800](#13800))
- Port push rules to using Rust. ([\#13768](#13768), [\#13838](#13838), [\#13889](#13889))
- Optimise get rooms for user calls. Contributed by Nick @ Beeper (@Fizzadar). ([\#13787](#13787))
- Update the script which makes full schema dumps. ([\#13792](#13792))
- Use shared methods for cache invalidation when persisting events, remove duplicate codepaths. Contributed by Nick @ Beeper (@Fizzadar). ([\#13796](#13796))
- Improve the `synapse.api.auth.Auth` mock used in unit tests. ([\#13809](#13809))
- Faster Remote Room Joins: tell remote homeservers that we are unable to authorise them if they query a room which has partial state on our server. ([\#13823](#13823))
- Carry IdP Session IDs through user-mapping sessions. ([\#13839](#13839))
- Fix the release script not publishing binary wheels. ([\#13850](#13850))
- Raise issue if complement fails with latest deps. ([\#13859](#13859))
- Correct the comments in the complement dockerfile. ([\#13867](#13867))
- Create a new snapshot of the database schema. ([\#13873](#13873))
- Faster room joins: Send device list updates to most servers in rooms with partial state. ([\#13874](#13874), [\#14013](#14013))
- Add comments to the Prometheus recording rules to make it clear which set of rules you need for Grafana or Prometheus Console. ([\#13876](#13876))
- Only pull relevant backfill points from the database based on the current depth and limit (instead of all) every time we want to `/backfill`. ([\#13879](#13879))
- Faster room joins: Avoid waiting for full state when processing `/keys/changes` requests. ([\#13888](#13888))
- Improve backfill robustness by trying more servers when we get a `4xx` error back. ([\#13890](#13890))
- Fix mypy errors with canonicaljson 1.6.3. ([\#13905](#13905))
- Faster remote room joins: correctly handle remote device list updates during a partial join. ([\#13913](#13913))
- Complement image: propagate SIGTERM to all workers. ([\#13914](#13914))
- Update an innaccurate comment in Synapse's upsert database helper. ([\#13924](#13924))
- Update mypy (0.950 -> 0.981) and mypy-zope (0.3.7 -> 0.3.11). ([\#13925](#13925), [\#13993](#13993))
- Use dedicated `get_local_users_in_room(room_id)` function to find local users when calculating users to copy over during a room upgrade. ([\#13960](#13960))
- Refactor language in user directory `_track_user_joined_room` code to make it more clear that we use both local and remote users. ([\#13966](#13966))
- Revert catch-all exceptions being recorded as event pull attempt failures (only handle what we know about). ([\#13969](#13969))
- Speed up calculating push actions in large rooms. ([\#13973](#13973), [\#13992](#13992))
- Enable update notifications from Github's dependabot. ([\#13976](#13976))
- Prototype a workflow to automatically add changelogs to dependabot PRs. ([\#13998](#13998), [\#14011](#14011), [\#14017](#14017), [\#14021](#14021), [\#14027](#14027))
- Fix type annotations to be compatible with new annotations in development versions of twisted. ([\#14012](#14012))
- Clear out stale entries in `event_push_actions_staging` table. ([\#14020](#14020))
- Bump versions of GitHub actions. ([\#13978](#13978), [\#13979](#13979), [\#13980](#13980), [\#13982](#13982), [\#14015](#14015), [\#14019](#14019), [\#14022](#14022), [\#14023](#14023))
Fizzadar added a commit to beeper/synapse-legacy-fork that referenced this pull request Oct 18, 2022
NOTE: this is absolutely *not* safe for Beeper usage as-is. I have merged
all of the Python code in but all our customizations to the base rules
and push rule evaluator are not yet present in the new Rust module. This
will fail tests as-is and future commits will re-apply our changes in
Rust.

Synapse 1.69.0 (2022-10-17)
===========================

Please note that legacy Prometheus metric names are now deprecated and will be removed in Synapse 1.73.0.
Server administrators should update their dashboards and alerting rules to avoid using the deprecated metric names.
See the [upgrade notes](https://matrix-org.github.io/synapse/v1.69/upgrade.html#upgrading-to-v1690) for more details.

No significant changes since 1.69.0rc4.

Synapse 1.69.0rc4 (2022-10-14)
==============================

Bugfixes
--------

- Fix poor performance of the `event_push_backfill_thread_id` background update, which was introduced in Synapse 1.68.0rc1. ([\matrix-org#14172](matrix-org#14172), [\matrix-org#14181](matrix-org#14181))

Updates to the Docker image
---------------------------

- Fix docker build OOMing in CI for arm64 builds. ([\matrix-org#14173](matrix-org#14173))

Synapse 1.69.0rc3 (2022-10-12)
==============================

Bugfixes
--------

- Fix an issue with Docker images causing the Rust dependencies to not be pinned correctly. Introduced in v1.68.0 ([\matrix-org#14129](matrix-org#14129))
- Fix a bug introduced in Synapse 1.69.0rc1 which would cause registration replication requests to fail if the worker sending the request is not running Synapse 1.69. ([\matrix-org#14135](matrix-org#14135))
- Fix error in background update when rotating existing notifications. Introduced in v1.69.0rc2. ([\matrix-org#14138](matrix-org#14138))

Internal Changes
----------------

- Rename the `url_preview` extra to `url-preview`, for compatability with poetry-core 1.3.0 and [PEP 685](https://peps.python.org/pep-0685/). From-source installations using this extra will need to install using the new name. ([\matrix-org#14085](matrix-org#14085))

Synapse 1.69.0rc2 (2022-10-06)
==============================

Deprecations and Removals
-------------------------

- Deprecate the `generate_short_term_login_token` method in favor of an async `create_login_token` method in the Module API. ([\matrix-org#13842](matrix-org#13842))

Internal Changes
----------------

- Ensure Synapse v1.69 works with upcoming database changes in v1.70. ([\matrix-org#14045](matrix-org#14045))
- Fix a bug introduced in Synapse v1.68.0 where messages could not be sent in rooms with non-integer `notifications` power level. ([\matrix-org#14073](matrix-org#14073))
- Temporarily pin build-system requirements to workaround an incompatibility with poetry-core 1.3.0. This will be reverted before the v1.69.0 release proper, see [\matrix-org#14079](matrix-org#14079). ([\matrix-org#14080](matrix-org#14080))

Synapse 1.69.0rc1 (2022-10-04)
==============================

Features
--------

- Allow application services to set the `origin_server_ts` of a state event by providing the query parameter `ts` in [`PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}`](https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3roomsroomidstateeventtypestatekey), per [MSC3316](matrix-org/matrix-spec-proposals#3316). Contributed by @lukasdenk. ([\matrix-org#11866](matrix-org#11866))
- Allow server admins to require a manual approval process before new accounts can be used (using [MSC3866](matrix-org/matrix-spec-proposals#3866)). ([\matrix-org#13556](matrix-org#13556))
- Exponentially backoff from backfilling the same event over and over. ([\matrix-org#13635](matrix-org#13635), [\matrix-org#13936](matrix-org#13936))
- Add cache invalidation across workers to module API. ([\matrix-org#13667](matrix-org#13667), [\matrix-org#13947](matrix-org#13947))
- Experimental implementation of [MSC3882](matrix-org/matrix-spec-proposals#3882) to allow an existing device/session to generate a login token for use on a new device/session. ([\matrix-org#13722](matrix-org#13722), [\matrix-org#13868](matrix-org#13868))
- Experimental support for thread-specific receipts ([MSC3771](matrix-org/matrix-spec-proposals#3771)). ([\matrix-org#13782](matrix-org#13782), [\matrix-org#13893](matrix-org#13893), [\matrix-org#13932](matrix-org#13932), [\matrix-org#13937](matrix-org#13937), [\matrix-org#13939](matrix-org#13939))
- Add experimental support for [MSC3881: Remotely toggle push notifications for another client](matrix-org/matrix-spec-proposals#3881). ([\matrix-org#13799](matrix-org#13799), [\matrix-org#13831](matrix-org#13831), [\matrix-org#13860](matrix-org#13860))
- Keep track when an event pulled over federation fails its signature check so we can intelligently back-off in the future. ([\matrix-org#13815](matrix-org#13815))
- Improve validation for the unspecced, internal-only `_matrix/client/unstable/add_threepid/msisdn/submit_token` endpoint. ([\matrix-org#13832](matrix-org#13832))
- Faster remote room joins: record _when_ we first partial-join to a room. ([\matrix-org#13892](matrix-org#13892))
- Support a `dir` parameter on the `/relations` endpoint per [MSC3715](matrix-org/matrix-spec-proposals#3715). ([\matrix-org#13920](matrix-org#13920))
- Ask mail servers receiving emails from Synapse to not send automatic replies (e.g. out-of-office responses). ([\matrix-org#13957](matrix-org#13957))

Bugfixes
--------

- Send push notifications for invites received over federation. ([\matrix-org#13719](matrix-org#13719), [\matrix-org#14014](matrix-org#14014))
- Fix a long-standing bug where typing events would be accepted from remote servers not present in a room. Also fix a bug where incoming typing events would cause other incoming events to get stuck during a fast join. ([\matrix-org#13830](matrix-org#13830))
- Fix a bug introduced in Synapse v1.53.0 where the experimental implementation of [MSC3715](matrix-org/matrix-spec-proposals#3715) would give incorrect results when paginating forward. ([\matrix-org#13840](matrix-org#13840))
- Fix access token leak to logs from proxy agent. ([\matrix-org#13855](matrix-org#13855))
- Fix `have_seen_event` cache not being invalidated after we persist an event which causes inefficiency effects like extra `/state` federation calls. ([\matrix-org#13863](matrix-org#13863))
- Faster room joins: Fix a bug introduced in 1.66.0 where an error would be logged when syncing after joining a room. ([\matrix-org#13872](matrix-org#13872))
- Fix a bug introduced in 1.66.0 where some required fields in the pushrules sent to clients were not present anymore. Contributed by Nico. ([\matrix-org#13904](matrix-org#13904))
- Fix packaging to include `Cargo.lock` in `sdist`. ([\matrix-org#13909](matrix-org#13909))
- Fix a long-standing bug where device updates could cause delays sending out to-device messages over federation. ([\matrix-org#13922](matrix-org#13922))
- Fix a bug introduced in v1.68.0 where Synapse would require `setuptools_rust` at runtime, even though the package is only required at build time. ([\matrix-org#13952](matrix-org#13952))
- Fix a long-standing bug where `POST /_matrix/client/v3/keys/query` requests could result in excessively large SQL queries. ([\matrix-org#13956](matrix-org#13956))
- Fix a performance regression in the `get_users_in_room` database query. Introduced in v1.67.0. ([\matrix-org#13972](matrix-org#13972))
- Fix a bug introduced in v1.68.0 bug where Rust extension wasn't built in `release` mode when using `poetry install`. ([\matrix-org#14009](matrix-org#14009))
- Do not return an unspecified `original_event` field when using the stable `/relations` endpoint. Introduced in Synapse v1.57.0. ([\matrix-org#14025](matrix-org#14025))
- Correctly handle a race with device lists when a remote user leaves during a partial join. ([\matrix-org#13885](matrix-org#13885))
- Correctly handle sending local device list updates to remote servers during a partial join. ([\matrix-org#13934](matrix-org#13934))

Improved Documentation
----------------------

- Add `worker_main_http_uri` for the worker generator bash script. ([\matrix-org#13772](matrix-org#13772))
- Update URL for the NixOS module for Synapse. ([\matrix-org#13818](matrix-org#13818))
- Fix a mistake in sso_mapping_providers.md: `map_user_attributes` is expected to return `display_name`, not `displayname`. ([\matrix-org#13836](matrix-org#13836))
- Fix a cross-link from the registration admin API to the `registration_shared_secret` configuration documentation. ([\matrix-org#13870](matrix-org#13870))
- Update the man page for the `hash_password` script to correct the default number of bcrypt rounds performed. ([\matrix-org#13911](matrix-org#13911), [\matrix-org#13930](matrix-org#13930))
- Emphasize the right reasons when to use `(room_id, event_id)` in a database schema. ([\matrix-org#13915](matrix-org#13915))
- Add instruction to contributing guide for running unit tests in parallel. Contributed by @ashfame. ([\matrix-org#13928](matrix-org#13928))
- Clarify that the `auto_join_rooms` config option can also be used with Space aliases. ([\matrix-org#13931](matrix-org#13931))
- Add some cross references to worker documentation. ([\matrix-org#13974](matrix-org#13974))
- Linkify urls in config documentation. ([\matrix-org#14003](matrix-org#14003))

Deprecations and Removals
-------------------------

- Remove the `complete_sso_login` method from the Module API which was deprecated in Synapse 1.13.0. ([\matrix-org#13843](matrix-org#13843))
- Announce that legacy metric names are deprecated, will be turned off by default in Synapse v1.71.0 and removed altogether in Synapse v1.73.0. See the upgrade notes for more information. ([\matrix-org#14024](matrix-org#14024))

Internal Changes
----------------

- Speed up creation of DM rooms. ([\matrix-org#13487](matrix-org#13487), [\matrix-org#13800](matrix-org#13800))
- Port push rules to using Rust. ([\matrix-org#13768](matrix-org#13768), [\matrix-org#13838](matrix-org#13838), [\matrix-org#13889](matrix-org#13889))
- Optimise get rooms for user calls. Contributed by Nick @ Beeper (@Fizzadar). ([\matrix-org#13787](matrix-org#13787))
- Update the script which makes full schema dumps. ([\matrix-org#13792](matrix-org#13792))
- Use shared methods for cache invalidation when persisting events, remove duplicate codepaths. Contributed by Nick @ Beeper (@Fizzadar). ([\matrix-org#13796](matrix-org#13796))
- Improve the `synapse.api.auth.Auth` mock used in unit tests. ([\matrix-org#13809](matrix-org#13809))
- Faster Remote Room Joins: tell remote homeservers that we are unable to authorise them if they query a room which has partial state on our server. ([\matrix-org#13823](matrix-org#13823))
- Carry IdP Session IDs through user-mapping sessions. ([\matrix-org#13839](matrix-org#13839))
- Fix the release script not publishing binary wheels. ([\matrix-org#13850](matrix-org#13850))
- Raise issue if complement fails with latest deps. ([\matrix-org#13859](matrix-org#13859))
- Correct the comments in the complement dockerfile. ([\matrix-org#13867](matrix-org#13867))
- Create a new snapshot of the database schema. ([\matrix-org#13873](matrix-org#13873))
- Faster room joins: Send device list updates to most servers in rooms with partial state. ([\matrix-org#13874](matrix-org#13874), [\matrix-org#14013](matrix-org#14013))
- Add comments to the Prometheus recording rules to make it clear which set of rules you need for Grafana or Prometheus Console. ([\matrix-org#13876](matrix-org#13876))
- Only pull relevant backfill points from the database based on the current depth and limit (instead of all) every time we want to `/backfill`. ([\matrix-org#13879](matrix-org#13879))
- Faster room joins: Avoid waiting for full state when processing `/keys/changes` requests. ([\matrix-org#13888](matrix-org#13888))
- Improve backfill robustness by trying more servers when we get a `4xx` error back. ([\matrix-org#13890](matrix-org#13890))
- Fix mypy errors with canonicaljson 1.6.3. ([\matrix-org#13905](matrix-org#13905))
- Faster remote room joins: correctly handle remote device list updates during a partial join. ([\matrix-org#13913](matrix-org#13913))
- Complement image: propagate SIGTERM to all workers. ([\matrix-org#13914](matrix-org#13914))
- Update an innaccurate comment in Synapse's upsert database helper. ([\matrix-org#13924](matrix-org#13924))
- Update mypy (0.950 -> 0.981) and mypy-zope (0.3.7 -> 0.3.11). ([\matrix-org#13925](matrix-org#13925), [\matrix-org#13993](matrix-org#13993))
- Use dedicated `get_local_users_in_room(room_id)` function to find local users when calculating users to copy over during a room upgrade. ([\matrix-org#13960](matrix-org#13960))
- Refactor language in user directory `_track_user_joined_room` code to make it more clear that we use both local and remote users. ([\matrix-org#13966](matrix-org#13966))
- Revert catch-all exceptions being recorded as event pull attempt failures (only handle what we know about). ([\matrix-org#13969](matrix-org#13969))
- Speed up calculating push actions in large rooms. ([\matrix-org#13973](matrix-org#13973), [\matrix-org#13992](matrix-org#13992))
- Enable update notifications from Github's dependabot. ([\matrix-org#13976](matrix-org#13976))
- Prototype a workflow to automatically add changelogs to dependabot PRs. ([\matrix-org#13998](matrix-org#13998), [\matrix-org#14011](matrix-org#14011), [\matrix-org#14017](matrix-org#14017), [\matrix-org#14021](matrix-org#14021), [\matrix-org#14027](matrix-org#14027))
- Fix type annotations to be compatible with new annotations in development versions of twisted. ([\matrix-org#14012](matrix-org#14012))
- Clear out stale entries in `event_push_actions_staging` table. ([\matrix-org#14020](matrix-org#14020))
- Bump versions of GitHub actions. ([\matrix-org#13978](matrix-org#13978), [\matrix-org#13979](matrix-org#13979), [\matrix-org#13980](matrix-org#13980), [\matrix-org#13982](matrix-org#13982), [\matrix-org#14015](matrix-org#14015), [\matrix-org#14019](matrix-org#14019), [\matrix-org#14022](matrix-org#14022), [\matrix-org#14023](matrix-org#14023))

# -----BEGIN PGP SIGNATURE-----
#
# iQFEBAABCgAuFiEEBTGR3/RnAzBGUif3pULk7RsPrAkFAmNNMOMQHGVyaWtAbWF0
# cml4Lm9yZwAKCRClQuTtGw+sCVnjB/9jpJRVnicteEpDfVX9iLo2qfIfcO/GhUJK
# pJhv4yuY9whAldvJpmNw2f9tfUbAMcvrjlFvNrjihWmXcAGFazC6i3fNBjPgZW2e
# Sxsuuy8xc9X/OqH2EUpHtNZQX3FfSbdBS93Z62ZO3R8tEbCQvjw6FXBdjjjf5uLO
# y5Lsx94+41FJYOhs1Kt4fN92B9WMACR6e/O1YcsDjIXsoZI3uqO1h8filbQIZee7
# DTATE7eIPtShs2Ezaaeuc7tZGVDyPvgWIbuxuT6OGx20zmuChYJgIcVaD1me4UzJ
# i9bVigtpYN0eUxuWnjLf7YC6Ys/Y9wZ7/lhdgaBwdbQKEJdpi+S4
# =JWaO
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Oct 17 11:39:31 2022 BST
# gpg:                using RSA key 053191DFF4670330465227F7A542E4ED1B0FAC09
# gpg:                issuer "erik@matrix.org"
# gpg: Can't check signature: No public key

# Conflicts:
#	docker/Dockerfile
#	pyproject.toml
#	synapse/_scripts/update_synapse_database.py
#	synapse/handlers/message.py
#	synapse/handlers/receipts.py
#	synapse/logging/context.py
#	synapse/push/baserules.py
#	synapse/push/bulk_push_rule_evaluator.py
#	synapse/push/push_rule_evaluator.py
#	synapse/replication/http/send_event.py
#	synapse/rest/admin/users.py
#	synapse/rest/client/read_marker.py
#	synapse/rest/client/receipts.py
#	synapse/rest/client/room.py
#	synapse/storage/_base.py
#	synapse/storage/databases/main/__init__.py
#	synapse/storage/databases/main/cache.py
#	synapse/storage/databases/main/events.py
#	synapse/storage/databases/main/receipts.py
#	tests/push/test_push_rule_evaluator.py
squahtx pushed a commit that referenced this pull request Jan 24, 2023
#13873 introduced a regression which causes sqlite database migrations
to no longer run inside a transaction. Wrap them in a transaction again,
to avoid database corruption when migrations are interrupted.

Fixes #14909.

Signed-off-by: Sean Quah <seanq@matrix.org>
squahtx added a commit that referenced this pull request Jan 25, 2023
#13873 introduced a regression which causes sqlite database migrations
to no longer run inside a transaction. Wrap them in a transaction again,
to avoid database corruption when migrations are interrupted.

Fixes #14909.

Signed-off-by: Sean Quah <seanq@matrix.org>
squahtx pushed a commit that referenced this pull request Jan 26, 2023
#14910 fixed the regression introduced by #13873 where sqlite database
migrataions would no longer run inside a transaction. However, it
committed the transaction before Synapse updated its bookkeeping of
which migrations have been run, which means that migrations may be run
again after they have completed successfully.

Leave the transaction open at the end of `executescript`, to restore the
old, correct behaviour.

Fixes #14909.

Signed-off-by: Sean Quah <seanq@matrix.org>
squahtx pushed a commit that referenced this pull request Jan 26, 2023
#14910 fixed the regression introduced by #13873 where sqlite database
migrataions would no longer run inside a transaction. However, it
committed the transaction before Synapse updated its bookkeeping of
which migrations have been run, which means that migrations may be run
again after they have completed successfully.

Leave the transaction open at the end of `executescript`, to restore the
old, correct behaviour.

Fixes #14909.

Signed-off-by: Sean Quah <seanq@matrix.org>
squahtx added a commit that referenced this pull request Jan 31, 2023
#14910 fixed the regression introduced by #13873 where sqlite database
migrations would no longer run inside a transaction. However, it
committed the transaction before Synapse updated its bookkeeping of
which migrations have been run, which means that migrations may be run
again after they have completed successfully.

Leave the transaction open at the end of `executescript`, to restore the
old, correct behaviour. Also make the PostgreSQL behaviour consistent
with SQLite.

Fixes #14909.

Signed-off-by: Sean Quah <seanq@matrix.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a new full schema snapshot
2 participants