Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5770 from matrix-org/erikj/fix_current_state_even…
Browse files Browse the repository at this point in the history
…t_sqlite

Fix current_state bg update to work on old SQLite
  • Loading branch information
erikjohnston authored Jul 29, 2019
2 parents 97a8b4c + d949168 commit 2a12d76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5770.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reduce database IO usage by optimising queries for current membership.
4 changes: 2 additions & 2 deletions synapse/storage/roommember.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,10 @@ def _background_current_state_membership_txn(txn, last_processed_room):
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 = ?
"""
Expand Down

0 comments on commit 2a12d76

Please sign in to comment.