Merge pull request #5770 from matrix-org/erikj/fix_current_state_event_sqlite

Fix current_state bg update to work on old SQLite
pull/5787/head
Erik Johnston 2019-07-29 17:09:01 +01:00 committed by GitHub
commit 2a12d76646
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -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:

1
changelog.d/5770.misc Normal file
View File

@ -0,0 +1 @@
Reduce database IO usage by optimising queries for current membership.

View File

@ -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 = ?
"""