From 8d7491a1520057a3195ea35533a976fa3f3b8e6d Mon Sep 17 00:00:00 2001 From: David Robertson Date: Fri, 1 Jul 2022 19:01:54 +0200 Subject: [PATCH 1/4] matrix-synapse-ldap3: 0.2.0 -> 0.2.1 (#13156) --- changelog.d/13156.bugfix | 1 + poetry.lock | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 changelog.d/13156.bugfix diff --git a/changelog.d/13156.bugfix b/changelog.d/13156.bugfix new file mode 100644 index 000000000..c5ca487c2 --- /dev/null +++ b/changelog.d/13156.bugfix @@ -0,0 +1 @@ +Update the version of the [ldap3 plugin](https://github.com/matrix-org/matrix-synapse-ldap3/) includled in matrix.org docker images and debian packages to 0.2.1. This fixes [problems involving usernames that have uppercase characters](https://github.com/matrix-org/matrix-synapse-ldap3/pull/163). diff --git a/poetry.lock b/poetry.lock index 49fbaab57..f069f692d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -540,7 +540,7 @@ test = ["tox", "twisted", "aiounittest"] [[package]] name = "matrix-synapse-ldap3" -version = "0.2.0" +version = "0.2.1" description = "An LDAP3 auth provider for Synapse" category = "main" optional = true @@ -552,7 +552,7 @@ service-identity = "*" Twisted = ">=15.1.0" [package.extras] -dev = ["matrix-synapse", "tox", "ldaptor", "mypy (==0.910)", "types-setuptools", "black (==21.9b0)", "flake8 (==4.0.1)", "isort (==5.9.3)"] +dev = ["matrix-synapse", "tox", "ldaptor", "mypy (==0.910)", "types-setuptools", "black (==22.3.0)", "flake8 (==4.0.1)", "isort (==5.9.3)"] [[package]] name = "mccabe" @@ -2046,8 +2046,8 @@ matrix-common = [ {file = "matrix_common-1.2.1.tar.gz", hash = "sha256:a99dcf02a6bd95b24a5a61b354888a2ac92bf2b4b839c727b8dd9da2cdfa3853"}, ] matrix-synapse-ldap3 = [ - {file = "matrix-synapse-ldap3-0.2.0.tar.gz", hash = "sha256:91a0715b43a41ec3033244174fca20846836da98fda711fb01687f7199eecd2e"}, - {file = "matrix_synapse_ldap3-0.2.0-py3-none-any.whl", hash = "sha256:0128ca7c3058987adc2e8a88463bb46879915bfd3d373309632813b353e30f9f"}, + {file = "matrix-synapse-ldap3-0.2.1.tar.gz", hash = "sha256:bfb4390f4a262ffb0d6f057ff3aeb1e46d4e52ff420a064d795fb4f555f00285"}, + {file = "matrix_synapse_ldap3-0.2.1-py3-none-any.whl", hash = "sha256:1b3310a60f1d06466f35905a269b6df95747fd1305f2b7fe638f373963b2aa2c"}, ] mccabe = [ {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, From 723ce73d0253adddfb0264ff50ca4ebce0b70130 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 4 Jul 2022 16:02:21 +0100 Subject: [PATCH 2/4] Fix stuck notification counts on small servers (#13168) --- changelog.d/13168.bugfix | 1 + synapse/storage/databases/main/event_push_actions.py | 9 +++++++-- tests/storage/test_event_push_actions.py | 10 +++++----- 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 changelog.d/13168.bugfix diff --git a/changelog.d/13168.bugfix b/changelog.d/13168.bugfix new file mode 100644 index 000000000..f462260c5 --- /dev/null +++ b/changelog.d/13168.bugfix @@ -0,0 +1 @@ +Fix unread counts for users on small servers. Introduced in v1.62.0rc1. diff --git a/synapse/storage/databases/main/event_push_actions.py b/synapse/storage/databases/main/event_push_actions.py index 7d4754b3d..505616e21 100644 --- a/synapse/storage/databases/main/event_push_actions.py +++ b/synapse/storage/databases/main/event_push_actions.py @@ -972,7 +972,12 @@ class EventPushActionsWorkerStore(ReceiptsWorkerStore, EventsWorkerStore, SQLBas stream_row = txn.fetchone() if stream_row: (offset_stream_ordering,) = stream_row - rotate_to_stream_ordering = offset_stream_ordering + + # We need to bound by the current token to ensure that we handle + # out-of-order writes correctly. + rotate_to_stream_ordering = min( + offset_stream_ordering, self._stream_id_gen.get_current_token() + ) caught_up = False else: rotate_to_stream_ordering = self._stream_id_gen.get_current_token() @@ -1004,7 +1009,7 @@ class EventPushActionsWorkerStore(ReceiptsWorkerStore, EventsWorkerStore, SQLBas SELECT user_id, room_id, count(*) as cnt, max(stream_ordering) as stream_ordering FROM event_push_actions - WHERE ? <= stream_ordering AND stream_ordering < ? + WHERE ? < stream_ordering AND stream_ordering <= ? AND %s = 1 GROUP BY user_id, room_id ) AS upd diff --git a/tests/storage/test_event_push_actions.py b/tests/storage/test_event_push_actions.py index 684485ae0..852b66338 100644 --- a/tests/storage/test_event_push_actions.py +++ b/tests/storage/test_event_push_actions.py @@ -146,12 +146,12 @@ class EventPushActionsStoreTestCase(HomeserverTestCase): _assert_counts(0, 0) _inject_actions(1, PlAIN_NOTIF) _assert_counts(1, 0) - _rotate(2) + _rotate(1) _assert_counts(1, 0) _inject_actions(3, PlAIN_NOTIF) _assert_counts(2, 0) - _rotate(4) + _rotate(3) _assert_counts(2, 0) _inject_actions(5, PlAIN_NOTIF) @@ -162,7 +162,7 @@ class EventPushActionsStoreTestCase(HomeserverTestCase): _assert_counts(0, 0) _inject_actions(6, PlAIN_NOTIF) - _rotate(7) + _rotate(6) _assert_counts(1, 0) self.get_success( @@ -178,13 +178,13 @@ class EventPushActionsStoreTestCase(HomeserverTestCase): _inject_actions(8, HIGHLIGHT) _assert_counts(1, 1) - _rotate(9) + _rotate(8) _assert_counts(1, 1) # Check that adding another notification and rotating after highlight # works. _inject_actions(10, PlAIN_NOTIF) - _rotate(11) + _rotate(10) _assert_counts(2, 1) # Check that sending read receipts at different points results in the From 046d87756bc157af83e4f75b514490464a89d3d0 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Mon, 4 Jul 2022 16:16:47 +0100 Subject: [PATCH 3/4] 1.62.0rc3 --- CHANGES.md | 10 ++++++++++ changelog.d/13156.bugfix | 1 - changelog.d/13168.bugfix | 1 - debian/changelog | 6 ++++++ pyproject.toml | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/13156.bugfix delete mode 100644 changelog.d/13168.bugfix diff --git a/CHANGES.md b/CHANGES.md index 50b4da5f6..1fb1ff9ab 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,13 @@ +Synapse 1.62.0rc3 (2022-07-04) +============================== + +Bugfixes +-------- + +- Update the version of the [ldap3 plugin](https://github.com/matrix-org/matrix-synapse-ldap3/) includled in matrix.org docker images and debian packages to 0.2.1. This fixes [problems involving usernames that have uppercase characters](https://github.com/matrix-org/matrix-synapse-ldap3/pull/163). ([\#13156](https://github.com/matrix-org/synapse/issues/13156)) +- Fix unread counts for users on small servers. Introduced in v1.62.0rc1. ([\#13168](https://github.com/matrix-org/synapse/issues/13168)) + + Synapse 1.62.0rc2 (2022-07-01) ============================== diff --git a/changelog.d/13156.bugfix b/changelog.d/13156.bugfix deleted file mode 100644 index c5ca487c2..000000000 --- a/changelog.d/13156.bugfix +++ /dev/null @@ -1 +0,0 @@ -Update the version of the [ldap3 plugin](https://github.com/matrix-org/matrix-synapse-ldap3/) includled in matrix.org docker images and debian packages to 0.2.1. This fixes [problems involving usernames that have uppercase characters](https://github.com/matrix-org/matrix-synapse-ldap3/pull/163). diff --git a/changelog.d/13168.bugfix b/changelog.d/13168.bugfix deleted file mode 100644 index f462260c5..000000000 --- a/changelog.d/13168.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix unread counts for users on small servers. Introduced in v1.62.0rc1. diff --git a/debian/changelog b/debian/changelog index 295532196..c3a727800 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +matrix-synapse-py3 (1.62.0~rc3) stable; urgency=medium + + * New Synapse release 1.62.0rc3. + + -- Synapse Packaging team Mon, 04 Jul 2022 16:07:01 +0100 + matrix-synapse-py3 (1.62.0~rc2) stable; urgency=medium * New Synapse release 1.62.0rc2. diff --git a/pyproject.toml b/pyproject.toml index 1abbf0f5e..b9f2ea432 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ skip_gitignore = true [tool.poetry] name = "matrix-synapse" -version = "1.62.0rc2" +version = "1.62.0rc3" description = "Homeserver for the Matrix decentralised comms protocol" authors = ["Matrix.org Team and Contributors "] license = "Apache-2.0" From 95a260da7342ef654a6da4985e0539225969ddde Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Mon, 4 Jul 2022 16:29:04 +0100 Subject: [PATCH 4/4] Update changelog for v1.62.0rc2 --- CHANGES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1fb1ff9ab..babfe1628 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,8 +4,8 @@ Synapse 1.62.0rc3 (2022-07-04) Bugfixes -------- -- Update the version of the [ldap3 plugin](https://github.com/matrix-org/matrix-synapse-ldap3/) includled in matrix.org docker images and debian packages to 0.2.1. This fixes [problems involving usernames that have uppercase characters](https://github.com/matrix-org/matrix-synapse-ldap3/pull/163). ([\#13156](https://github.com/matrix-org/synapse/issues/13156)) -- Fix unread counts for users on small servers. Introduced in v1.62.0rc1. ([\#13168](https://github.com/matrix-org/synapse/issues/13168)) +- Update the version of the [ldap3 plugin](https://github.com/matrix-org/matrix-synapse-ldap3/) included in the `matrixdotorg/synapse` DockerHub images and the Debian packages hosted on `packages.matrix.org` to 0.2.1. This fixes [a bug](https://github.com/matrix-org/matrix-synapse-ldap3/pull/163) with usernames containing uppercase characters. ([\#13156](https://github.com/matrix-org/synapse/issues/13156)) +- Fix a bug introduced in Synapse 1.62.0rc1 affecting unread counts for users on small servers. ([\#13168](https://github.com/matrix-org/synapse/issues/13168)) Synapse 1.62.0rc2 (2022-07-01)