summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrej Shadura <andrewsh@debian.org>2021-12-21 20:54:08 +0100
committerAndrej Shadura <andrewsh@debian.org>2021-12-21 20:54:08 +0100
commit3c4dd4c256cce3d9f54435f37a0cf5207cef1906 (patch)
treec980f85340337799bad2cb1ba0fe19c70f72e660
parent80f2e25f3c5a7511dab422636cf122c838081a60 (diff)
Cherry-pick an upstream fix from 1.49.2
-rw-r--r--debian/patches/0003-Disable-aggregation-bundling-on-sync-responses-11583.patch60
-rw-r--r--debian/patches/series1
2 files changed, 61 insertions, 0 deletions
diff --git a/debian/patches/0003-Disable-aggregation-bundling-on-sync-responses-11583.patch b/debian/patches/0003-Disable-aggregation-bundling-on-sync-responses-11583.patch
new file mode 100644
index 00000000..bc86fb55
--- /dev/null
+++ b/debian/patches/0003-Disable-aggregation-bundling-on-sync-responses-11583.patch
@@ -0,0 +1,60 @@
+From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
+Date: Mon, 20 Dec 2021 16:33:35 +0000
+Subject: Disable aggregation bundling on `/sync` responses (#11583)
+
+* Disable aggregation bundling on `/sync` responses
+
+A partial revert of #11478. This turns out to have had a significant CPU impact
+on initial-sync handling. For now, let's disable it, until we find a more
+efficient way of achieving this.
+
+* Fix tests.
+
+Co-authored-by: Patrick Cloke <patrickc@matrix.org>
+---
+ synapse/rest/client/sync.py | 10 +++++++++-
+ tests/rest/client/test_relations.py | 10 +++++-----
+ 2 files changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/synapse/rest/client/sync.py b/synapse/rest/client/sync.py
+index 88e4f5e..7f5846d 100644
+--- a/synapse/rest/client/sync.py
++++ b/synapse/rest/client/sync.py
+@@ -522,7 +522,15 @@ class SyncRestServlet(RestServlet):
+ time_now=time_now,
+ # Don't bother to bundle aggregations if the timeline is unlimited,
+ # as clients will have all the necessary information.
+- bundle_aggregations=room.timeline.limited,
++ # bundle_aggregations=room.timeline.limited,
++ #
++ # richvdh 2021-12-15: disable this temporarily as it has too high an
++ # overhead for initialsyncs. We need to figure out a way that the
++ # bundling can be done *before* the events are stored in the
++ # SyncResponseCache so that this part can be synchronous.
++ #
++ # Ensure to re-enable the test at tests/rest/client/test_relations.py::RelationsTestCase.test_bundled_aggregations.
++ bundle_aggregations=False,
+ token_id=token_id,
+ event_format=event_formatter,
+ only_event_fields=only_fields,
+diff --git a/tests/rest/client/test_relations.py b/tests/rest/client/test_relations.py
+index 397c12c..1b58b73 100644
+--- a/tests/rest/client/test_relations.py
++++ b/tests/rest/client/test_relations.py
+@@ -574,11 +574,11 @@ class RelationsTestCase(unittest.HomeserverTestCase):
+ assert_bundle(channel.json_body["event"]["unsigned"].get("m.relations"))
+
+ # Request sync.
+- channel = self.make_request("GET", "/sync", access_token=self.user_token)
+- self.assertEquals(200, channel.code, channel.json_body)
+- room_timeline = channel.json_body["rooms"]["join"][self.room]["timeline"]
+- self.assertTrue(room_timeline["limited"])
+- _find_and_assert_event(room_timeline["events"])
++ # channel = self.make_request("GET", "/sync", access_token=self.user_token)
++ # self.assertEquals(200, channel.code, channel.json_body)
++ # room_timeline = channel.json_body["rooms"]["join"][self.room]["timeline"]
++ # self.assertTrue(room_timeline["limited"])
++ # _find_and_assert_event(room_timeline["events"])
+
+ # Note that /relations is tested separately in test_aggregation_get_event_for_thread
+ # since it needs different data configured.
diff --git a/debian/patches/series b/debian/patches/series
index e35aaf80..56df1e20 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
0001-change_instructions.patch
0002-dont-bump-cryptography.patch
+0003-Disable-aggregation-bundling-on-sync-responses-11583.patch