From 248046187940372c23466cb395b46ed97ebda1ed Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Mon, 30 May 2022 10:51:09 +0100 Subject: [PATCH] Fix `get_metadata_for_events` (#12904) This method was introduced in #12852. It is using the `state_key` column from the `events` table, which is not (yet) reliable (see #11496). --- changelog.d/12904.misc | 1 + synapse/storage/databases/main/state.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog.d/12904.misc diff --git a/changelog.d/12904.misc b/changelog.d/12904.misc new file mode 100644 index 0000000000..afca32471f --- /dev/null +++ b/changelog.d/12904.misc @@ -0,0 +1 @@ +Pull out less state when handling gaps in room DAG. diff --git a/synapse/storage/databases/main/state.py b/synapse/storage/databases/main/state.py index ea5cbdac08..a07ad85582 100644 --- a/synapse/storage/databases/main/state.py +++ b/synapse/storage/databases/main/state.py @@ -167,8 +167,8 @@ class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore): ) sql = f""" - SELECT e.event_id, e.room_id, e.type, e.state_key FROM events AS e - LEFT JOIN state_events USING (event_id) + SELECT e.event_id, e.room_id, e.type, se.state_key FROM events AS e + LEFT JOIN state_events se USING (event_id) WHERE {clause} """