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

Fix quarantine media admin API and search reindex #3130

Merged
merged 2 commits into from
Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion synapse/storage/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ def _get_media_mxcs_in_room_txn(self, txn, room_id):
while next_token:
sql = """
SELECT stream_ordering, json FROM events
JOIN event_json USING (event_id)
JOIN event_json USING (room_id, event_id)
WHERE room_id = ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be preferable to update this to WHERE events.room_id = ? ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't really change anything query optimisation wise, other than giving the optimiser more leeway over which index to use.

AND stream_ordering < ?
AND contains_url = ? AND outlier = ?
Expand Down
2 changes: 1 addition & 1 deletion synapse/storage/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def reindex_search_txn(txn):
sql = (
"SELECT stream_ordering, event_id, room_id, type, json, "
" origin_server_ts FROM events"
" JOIN event_json USING (event_id)"
" JOIN event_json USING (room_id, event_id)"
" WHERE ? <= stream_ordering AND stream_ordering < ?"
" AND (%s)"
" ORDER BY stream_ordering DESC"
Expand Down