diff options
author | Erik Johnston <erik@matrix.org> | 2019-07-29 17:09:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-29 17:09:01 +0100 |
commit | 2a12d76646de2477feb477295dc5352dd08bf63b (patch) | |
tree | 7131c8dcebe66732cf0a7a914c45536fe7ce743c | |
parent | Move some timeout checking logs to DEBUG #5785 (diff) | |
parent | Newsfile (diff) | |
download | synapse-2a12d76646de2477feb477295dc5352dd08bf63b.tar.xz |
Merge pull request #5770 from matrix-org/erikj/fix_current_state_event_sqlite
Fix current_state bg update to work on old SQLite
-rw-r--r-- | .buildkite/pipeline.yml | 5 | ||||
-rw-r--r-- | changelog.d/5770.misc | 1 | ||||
-rw-r--r-- | synapse/storage/roommember.py | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index c8ae1a44be..b75269a155 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -49,14 +49,15 @@ steps: - command: - - "python -m pip install tox" + - "apt-get update && apt-get install -y python3.5 python3.5-dev python3-pip libxml2-dev libxslt-dev zlib1g-dev" + - "python3.5 -m pip install tox" - "tox -e py35-old,codecov" label: ":python: 3.5 / SQLite / Old Deps" env: TRIAL_FLAGS: "-j 2" plugins: - docker#v3.0.1: - image: "python:3.5" + image: "ubuntu:xenial" # We use xenail to get an old sqlite and python propagate-environment: true retry: automatic: diff --git a/changelog.d/5770.misc b/changelog.d/5770.misc new file mode 100644 index 0000000000..5e15dfd5fa --- /dev/null +++ b/changelog.d/5770.misc @@ -0,0 +1 @@ +Reduce database IO usage by optimising queries for current membership. diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py index cb88e49b51..a1b9fd8199 100644 --- a/synapse/storage/roommember.py +++ b/synapse/storage/roommember.py @@ -870,10 +870,10 @@ class RoomMemberStore(RoomMemberWorkerStore): next_room, = row sql = """ - UPDATE current_state_events AS c + UPDATE current_state_events SET membership = ( SELECT membership FROM room_memberships - WHERE event_id = c.event_id + WHERE event_id = current_state_events.event_id ) WHERE room_id = ? """ |