From 8689230a55cf1bb8e959e993fd4b28dcee0716da Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 16 May 2022 12:06:56 +0100 Subject: [PATCH 1/3] Fix bug /sync returning 404 (#12729) * Fix bug /sync returning 404 Fixes #12571 --- changelog.d/12729.bugfix | 1 + synapse/storage/databases/main/stream.py | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 changelog.d/12729.bugfix diff --git a/changelog.d/12729.bugfix b/changelog.d/12729.bugfix new file mode 100644 index 000000000..07aae23ac --- /dev/null +++ b/changelog.d/12729.bugfix @@ -0,0 +1 @@ +Fix a bug introduced in Synapse 1.58.0 where `/sync` would fail if the most recent event in a room was rejected. diff --git a/synapse/storage/databases/main/stream.py b/synapse/storage/databases/main/stream.py index 793e90663..3c3137fe6 100644 --- a/synapse/storage/databases/main/stream.py +++ b/synapse/storage/databases/main/stream.py @@ -743,14 +743,17 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore): """ def _f(txn: LoggingTransaction) -> Optional[Tuple[int, int, str]]: - sql = ( - "SELECT stream_ordering, topological_ordering, event_id" - " FROM events" - " WHERE room_id = ? AND stream_ordering <= ?" - " AND NOT outlier" - " ORDER BY stream_ordering DESC" - " LIMIT 1" - ) + sql = """ + SELECT stream_ordering, topological_ordering, event_id + FROM events + LEFT JOIN rejections USING (event_id) + WHERE room_id = ? + AND stream_ordering <= ? + AND NOT outlier + AND rejections.reason IS NULL + ORDER BY stream_ordering DESC + LIMIT 1 + """ txn.execute(sql, (room_id, stream_ordering)) return cast(Optional[Tuple[int, int, str]], txn.fetchone()) From c3b232cb399c5098d27e6eb50e0d350774b0afd3 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 16 May 2022 12:52:29 +0100 Subject: [PATCH 2/3] 1.59.0rc2 --- CHANGES.md | 9 +++++++++ changelog.d/12729.bugfix | 1 - debian/changelog | 6 ++++++ pyproject.toml | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) delete mode 100644 changelog.d/12729.bugfix diff --git a/CHANGES.md b/CHANGES.md index c625e4d56..ccb5d1432 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,12 @@ +Synapse 1.59.0rc2 (2022-05-16) +============================== + +Bugfixes +-------- + +- Fix a bug introduced in Synapse 1.58.0 where `/sync` would fail if the most recent event in a room was rejected. ([\#12729](https://github.com/matrix-org/synapse/issues/12729)) + + Synapse 1.59.0rc1 (2022-05-10) ============================== diff --git a/changelog.d/12729.bugfix b/changelog.d/12729.bugfix deleted file mode 100644 index 07aae23ac..000000000 --- a/changelog.d/12729.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix a bug introduced in Synapse 1.58.0 where `/sync` would fail if the most recent event in a room was rejected. diff --git a/debian/changelog b/debian/changelog index fabc690ba..7f9bedd7a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +matrix-synapse-py3 (1.59.0~rc2) stable; urgency=medium + + * New Synapse release 1.59.0rc2. + + -- Synapse Packaging team Mon, 16 May 2022 12:52:15 +0100 + matrix-synapse-py3 (1.59.0~rc1) stable; urgency=medium * Adjust how the `exported-requirements.txt` file is generated as part of diff --git a/pyproject.toml b/pyproject.toml index e3d81ae5f..1a2ddddb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ skip_gitignore = true [tool.poetry] name = "matrix-synapse" -version = "1.59.0rc1" +version = "1.59.0rc2" description = "Homeserver for the Matrix decentralised comms protocol" authors = ["Matrix.org Team and Contributors "] license = "Apache-2.0" From 6f04ae70331c21bd5026662e7281eaa01933af27 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 16 May 2022 12:53:10 +0100 Subject: [PATCH 3/3] Move 1.59 warning to the top --- CHANGES.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ccb5d1432..347aae8f6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,15 @@ Synapse 1.59.0rc2 (2022-05-16) ============================== +Synapse 1.59 makes several changes that server administrators should be aware of: + +- Device name lookup over federation is now disabled by default. ([\#12616](https://github.com/matrix-org/synapse/issues/12616)) +- The `synapse.app.appservice` and `synapse.app.user_dir` worker application types are now deprecated. ([\#12452](https://github.com/matrix-org/synapse/issues/12452), [\#12654](https://github.com/matrix-org/synapse/issues/12654)) + +See [the upgrade notes](https://github.com/matrix-org/synapse/blob/develop/docs/upgrade.md#upgrading-to-v1590) for more details. + +Additionally, this release removes the non-standard `m.login.jwt` login type from Synapse. It can be replaced with `org.matrix.login.jwt` for identical behaviour. This is only used if `jwt_config.enabled` is set to `true` in the configuration. ([\#12597](https://github.com/matrix-org/synapse/issues/12597)) + Bugfixes -------- @@ -10,15 +19,6 @@ Bugfixes Synapse 1.59.0rc1 (2022-05-10) ============================== -This release makes several changes that server administrators should be aware of: - -- Device name lookup over federation is now disabled by default. ([\#12616](https://github.com/matrix-org/synapse/issues/12616)) -- The `synapse.app.appservice` and `synapse.app.user_dir` worker application types are now deprecated. ([\#12452](https://github.com/matrix-org/synapse/issues/12452), [\#12654](https://github.com/matrix-org/synapse/issues/12654)) - -See [the upgrade notes](https://github.com/matrix-org/synapse/blob/develop/docs/upgrade.md#upgrading-to-v1590) for more details. - -Additionally, this release removes the non-standard `m.login.jwt` login type from Synapse. It can be replaced with `org.matrix.login.jwt` for identical behaviour. This is only used if `jwt_config.enabled` is set to `true` in the configuration. ([\#12597](https://github.com/matrix-org/synapse/issues/12597)) - Features --------