diff --git a/CHANGES.md b/CHANGES.md index 4ac25a378..f04c7ef02 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,49 @@ +# Synapse 1.129.0 (2025-05-06) + +No significant changes since 1.129.0rc2. + + + + +# Synapse 1.129.0rc2 (2025-04-30) + +Synapse 1.129.0rc1 was never formally released due to regressions discovered during the release process. 1.129.0rc2 fixes those regressions by reverting the affected PRs. + +### Internal Changes + +- Revert the slow background update introduced by [\#18068](https://github.com/element-hq/synapse/issues/18068) in v1.128.0. ([\#18372](https://github.com/element-hq/synapse/issues/18372)) +- Revert "Add total event, unencrypted message, and e2ee event counts to stats reporting", added in v1.129.0rc1. ([\#18373](https://github.com/element-hq/synapse/issues/18373)) + + + + +# Synapse 1.129.0rc1 (2025-04-15) + +### Features + +- Add `passthrough_authorization_parameters` in OIDC configuration to allow passing parameters to the authorization grant URL. ([\#18232](https://github.com/element-hq/synapse/issues/18232)) +- Add `total_event_count`, `total_message_count`, and `total_e2ee_event_count` fields to the homeserver usage statistics. ([\#18260](https://github.com/element-hq/synapse/issues/18260)) + +### Bugfixes + +- Fix `force_tracing_for_users` config when using delegated auth. ([\#18334](https://github.com/element-hq/synapse/issues/18334)) +- Fix the token introspection cache logging access tokens when MAS integration is in use. ([\#18335](https://github.com/element-hq/synapse/issues/18335)) +- Stop caching introspection failures when delegating auth to MAS. ([\#18339](https://github.com/element-hq/synapse/issues/18339)) +- Fix `ExternalIDReuse` exception after migrating to MAS on workers with a high traffic. ([\#18342](https://github.com/element-hq/synapse/issues/18342)) +- Fix minor performance regression caused by tracking of room participation. Regressed in v1.128.0. ([\#18345](https://github.com/element-hq/synapse/issues/18345)) + +### Updates to the Docker image + +- Optimize the build of the complement-synapse image. ([\#18294](https://github.com/element-hq/synapse/issues/18294)) + +### Internal Changes + +- Disable statement timeout during room purge. ([\#18133](https://github.com/element-hq/synapse/issues/18133)) +- Add cache to storage functions used to auth requests when using delegated auth. ([\#18337](https://github.com/element-hq/synapse/issues/18337)) + + + + # Synapse 1.128.0 (2025-04-08) No significant changes since 1.128.0rc1. diff --git a/changelog.d/18133.misc b/changelog.d/18133.misc deleted file mode 100644 index 151ceb2ca..000000000 --- a/changelog.d/18133.misc +++ /dev/null @@ -1 +0,0 @@ -Disable statement timeout during room purge. diff --git a/changelog.d/18232.feature b/changelog.d/18232.feature deleted file mode 100644 index ba5059ba8..000000000 --- a/changelog.d/18232.feature +++ /dev/null @@ -1 +0,0 @@ -Add `passthrough_authorization_parameters` in OIDC configuration to allow to pass parameters to the authorization grant URL. diff --git a/changelog.d/18294.docker b/changelog.d/18294.docker deleted file mode 100644 index cc40ca90c..000000000 --- a/changelog.d/18294.docker +++ /dev/null @@ -1 +0,0 @@ -Optimize the build of the complement-synapse image. diff --git a/changelog.d/18334.bugfix b/changelog.d/18334.bugfix deleted file mode 100644 index d82e522cb..000000000 --- a/changelog.d/18334.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix `force_tracing_for_users` config when using delegated auth. diff --git a/changelog.d/18335.bugfix b/changelog.d/18335.bugfix deleted file mode 100644 index 50df5a1b1..000000000 --- a/changelog.d/18335.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix the token introspection cache logging access tokens when MAS integration is in use. \ No newline at end of file diff --git a/changelog.d/18337.misc b/changelog.d/18337.misc deleted file mode 100644 index b78276fe7..000000000 --- a/changelog.d/18337.misc +++ /dev/null @@ -1 +0,0 @@ -Add cache to storage functions used to auth requests when using delegated auth. diff --git a/changelog.d/18339.bugfix b/changelog.d/18339.bugfix deleted file mode 100644 index 09d6d7342..000000000 --- a/changelog.d/18339.bugfix +++ /dev/null @@ -1 +0,0 @@ -Stop caching introspection failures when delegating auth to MAS. diff --git a/changelog.d/18342.bugfix b/changelog.d/18342.bugfix deleted file mode 100644 index 6fa2fa679..000000000 --- a/changelog.d/18342.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix `ExternalIDReuse` exception after migrating to MAS on workers with a high traffic. diff --git a/changelog.d/18345.bugfix b/changelog.d/18345.bugfix deleted file mode 100644 index c8a001d4a..000000000 --- a/changelog.d/18345.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix minor performance regression caused by tracking of room participation. Regressed in v1.128.0. diff --git a/debian/changelog b/debian/changelog index 56839ac5b..2c1cb2062 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,21 @@ +matrix-synapse-py3 (1.129.0) stable; urgency=medium + + * New Synapse release 1.129.0. + + -- Synapse Packaging team Tue, 06 May 2025 12:22:11 +0100 + +matrix-synapse-py3 (1.129.0~rc2) stable; urgency=medium + + * New synapse release 1.129.0rc2. + + -- Synapse Packaging team Wed, 30 Apr 2025 13:13:16 +0000 + +matrix-synapse-py3 (1.129.0~rc1) stable; urgency=medium + + * New Synapse release 1.129.0rc1. + + -- Synapse Packaging team Tue, 15 Apr 2025 10:47:43 -0600 + matrix-synapse-py3 (1.128.0) stable; urgency=medium * New Synapse release 1.128.0. diff --git a/pyproject.toml b/pyproject.toml index 8f8eb46e6..24ae0db05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,7 +97,7 @@ module-name = "synapse.synapse_rust" [tool.poetry] name = "matrix-synapse" -version = "1.128.0" +version = "1.129.0" description = "Homeserver for the Matrix decentralised comms protocol" authors = ["Matrix.org Team and Contributors "] license = "AGPL-3.0-or-later" diff --git a/synapse/storage/databases/main/roommember.py b/synapse/storage/databases/main/roommember.py index dfa7dd48d..b8c78baa6 100644 --- a/synapse/storage/databases/main/roommember.py +++ b/synapse/storage/databases/main/roommember.py @@ -1693,93 +1693,6 @@ class RoomMemberBackgroundUpdateStore(SQLBaseStore): columns=["user_id", "room_id"], ) - self.db_pool.updates.register_background_update_handler( - "populate_participant_bg_update", self._populate_participant - ) - - async def _populate_participant(self, progress: JsonDict, batch_size: int) -> int: - """ - Background update to populate column `participant` on `room_memberships` table - - A 'participant' is someone who is currently joined to a room and has sent at least - one `m.room.message` or `m.room.encrypted` event. - - This background update will set the `participant` column across all rows in - `room_memberships` based on the user's *current* join status, and if - they've *ever* sent a message or encrypted event. Therefore one should - never assume the `participant` column's value is based solely on whether - the user participated in a previous "session" (where a "session" is defined - as a period between the user joining and leaving). See - https://github.com/element-hq/synapse/pull/18068#discussion_r1931070291 - for further detail. - """ - stream_token = progress.get("last_stream_token", None) - - def _get_max_stream_token_txn(txn: LoggingTransaction) -> int: - sql = """ - SELECT event_stream_ordering from room_memberships - ORDER BY event_stream_ordering DESC - LIMIT 1; - """ - txn.execute(sql) - res = txn.fetchone() - if not res or not res[0]: - return 0 - return res[0] - - def _background_populate_participant_txn( - txn: LoggingTransaction, stream_token: str - ) -> None: - sql = """ - UPDATE room_memberships - SET participant = True - FROM ( - SELECT DISTINCT c.state_key, e.room_id - FROM current_state_events AS c - INNER JOIN events AS e ON c.room_id = e.room_id - WHERE c.membership = 'join' - AND c.state_key = e.sender - AND ( - e.type = 'm.room.message' - OR e.type = 'm.room.encrypted' - ) - ) AS subquery - WHERE room_memberships.user_id = subquery.state_key - AND room_memberships.room_id = subquery.room_id - AND room_memberships.event_stream_ordering <= ? - AND room_memberships.event_stream_ordering > ?; - """ - batch = int(stream_token) - _POPULATE_PARTICIPANT_BG_UPDATE_BATCH_SIZE - txn.execute(sql, (stream_token, batch)) - - if stream_token is None: - stream_token = await self.db_pool.runInteraction( - "_get_max_stream_token", _get_max_stream_token_txn - ) - - if stream_token < 0: - await self.db_pool.updates._end_background_update( - "populate_participant_bg_update" - ) - return _POPULATE_PARTICIPANT_BG_UPDATE_BATCH_SIZE - - await self.db_pool.runInteraction( - "_background_populate_participant_txn", - _background_populate_participant_txn, - stream_token, - ) - - progress["last_stream_token"] = ( - stream_token - _POPULATE_PARTICIPANT_BG_UPDATE_BATCH_SIZE - ) - await self.db_pool.runInteraction( - "populate_participant_bg_update", - self.db_pool.updates._background_update_progress_txn, - "populate_participant_bg_update", - progress, - ) - return _POPULATE_PARTICIPANT_BG_UPDATE_BATCH_SIZE - async def _background_add_membership_profile( self, progress: JsonDict, batch_size: int ) -> int: diff --git a/synapse/storage/schema/__init__.py b/synapse/storage/schema/__init__.py index ad683a3a0..3c3b13437 100644 --- a/synapse/storage/schema/__init__.py +++ b/synapse/storage/schema/__init__.py @@ -19,7 +19,7 @@ # # -SCHEMA_VERSION = 91 # remember to update the list below when updating +SCHEMA_VERSION = 92 # remember to update the list below when updating """Represents the expectations made by the codebase about the database schema This should be incremented whenever the codebase changes its requirements on the @@ -162,6 +162,12 @@ Changes in SCHEMA_VERSION = 89 Changes in SCHEMA_VERSION = 90 - Add a column `participant` to `room_memberships` table - Add background update to delete unreferenced state groups. + +Changes in SCHEMA_VERSION = 91 + - Add a `sha256` column to the `local_media_repository` and `remote_media_cache` tables. + +Changes in SCHEMA_VERSION = 92 + - Cleaned up a trigger that was added in #18260 and then reverted. """ diff --git a/synapse/storage/schema/main/delta/90/01_add_column_participant_room_memberships_table.sql b/synapse/storage/schema/main/delta/90/01_add_column_participant_room_memberships_table.sql index 672be1031..dafd04649 100644 --- a/synapse/storage/schema/main/delta/90/01_add_column_participant_room_memberships_table.sql +++ b/synapse/storage/schema/main/delta/90/01_add_column_participant_room_memberships_table.sql @@ -13,8 +13,4 @@ -- Add a column `participant` to `room_memberships` table to track whether a room member has sent -- a `m.room.message` or `m.room.encrypted` event into a room they are a member of -ALTER TABLE room_memberships ADD COLUMN participant BOOLEAN DEFAULT FALSE; - --- Add a background update to populate `participant` column -INSERT INTO background_updates (ordering, update_name, progress_json) VALUES - (9001, 'populate_participant_bg_update', '{}'); \ No newline at end of file +ALTER TABLE room_memberships ADD COLUMN participant BOOLEAN DEFAULT FALSE; \ No newline at end of file diff --git a/synapse/storage/schema/main/delta/92/01_remove_trigger.sql.postgres b/synapse/storage/schema/main/delta/92/01_remove_trigger.sql.postgres new file mode 100644 index 000000000..e9f160cdc --- /dev/null +++ b/synapse/storage/schema/main/delta/92/01_remove_trigger.sql.postgres @@ -0,0 +1,16 @@ +-- +-- This file is licensed under the Affero General Public License (AGPL) version 3. +-- +-- Copyright (C) 2025 New Vector, Ltd +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- See the GNU Affero General Public License for more details: +-- . + +-- Removes the trigger that was added in #18260 and then reverted +DROP TRIGGER IF EXISTS event_stats_increment_counts_trigger ON events; +DROP FUNCTION IF EXISTS event_stats_increment_counts(); diff --git a/synapse/storage/schema/main/delta/92/01_remove_trigger.sql.sqlite b/synapse/storage/schema/main/delta/92/01_remove_trigger.sql.sqlite new file mode 100644 index 000000000..b5f084dde --- /dev/null +++ b/synapse/storage/schema/main/delta/92/01_remove_trigger.sql.sqlite @@ -0,0 +1,16 @@ +-- +-- This file is licensed under the Affero General Public License (AGPL) version 3. +-- +-- Copyright (C) 2025 New Vector, Ltd +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- See the GNU Affero General Public License for more details: +-- . + +-- Removes the trigger that was added in #18260 and then reverted +DROP TRIGGER IF EXISTS event_stats_events_insert_trigger; +DROP TRIGGER IF EXISTS event_stats_events_delete_trigger; diff --git a/synapse/storage/schema/main/delta/92/02_remove_populate_participant_bg_update.sql b/synapse/storage/schema/main/delta/92/02_remove_populate_participant_bg_update.sql new file mode 100644 index 000000000..e1f377c37 --- /dev/null +++ b/synapse/storage/schema/main/delta/92/02_remove_populate_participant_bg_update.sql @@ -0,0 +1,17 @@ +-- +-- This file is licensed under the Affero General Public License (AGPL) version 3. +-- +-- Copyright (C) 2025 New Vector, Ltd +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- See the GNU Affero General Public License for more details: +-- . + +-- Remove the background update if it was scheduled, as it is not rollback-safe +-- See https://github.com/element-hq/synapse/issues/18356 for context +DELETE FROM background_updates +WHERE update_name = 'populate_participant_bg_update'; \ No newline at end of file