Merge pull request #5770 from matrix-org/erikj/fix_current_state_event_sqlite
Fix current_state bg update to work on old SQLite
This commit is contained in:
commit
2a12d76646
|
@ -49,14 +49,15 @@ steps:
|
||||||
|
|
||||||
|
|
||||||
- command:
|
- 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"
|
- "tox -e py35-old,codecov"
|
||||||
label: ":python: 3.5 / SQLite / Old Deps"
|
label: ":python: 3.5 / SQLite / Old Deps"
|
||||||
env:
|
env:
|
||||||
TRIAL_FLAGS: "-j 2"
|
TRIAL_FLAGS: "-j 2"
|
||||||
plugins:
|
plugins:
|
||||||
- docker#v3.0.1:
|
- docker#v3.0.1:
|
||||||
image: "python:3.5"
|
image: "ubuntu:xenial" # We use xenail to get an old sqlite and python
|
||||||
propagate-environment: true
|
propagate-environment: true
|
||||||
retry:
|
retry:
|
||||||
automatic:
|
automatic:
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Reduce database IO usage by optimising queries for current membership.
|
|
@ -870,10 +870,10 @@ class RoomMemberStore(RoomMemberWorkerStore):
|
||||||
next_room, = row
|
next_room, = row
|
||||||
|
|
||||||
sql = """
|
sql = """
|
||||||
UPDATE current_state_events AS c
|
UPDATE current_state_events
|
||||||
SET membership = (
|
SET membership = (
|
||||||
SELECT membership FROM room_memberships
|
SELECT membership FROM room_memberships
|
||||||
WHERE event_id = c.event_id
|
WHERE event_id = current_state_events.event_id
|
||||||
)
|
)
|
||||||
WHERE room_id = ?
|
WHERE room_id = ?
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue