Move index creation to background update (#18439)
Follow on from #18375. This prevents blocking startup on creating the index, which can take a while --------- Co-authored-by: Devon Hudson <devon.dmytro@gmail.com>
This commit is contained in:
parent
99c15f4630
commit
f5ed52c1e2
1
changelog.d/18439.bugfix
Normal file
1
changelog.d/18439.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Fix startup being blocked on creating a new index. Introduced in v1.130.0rc1.
|
||||
@ -68,6 +68,14 @@ class SlidingSyncStore(SQLBaseStore):
|
||||
columns=("membership_event_id",),
|
||||
)
|
||||
|
||||
self.db_pool.updates.register_background_index_update(
|
||||
update_name="sliding_sync_membership_snapshots_user_id_stream_ordering",
|
||||
index_name="sliding_sync_membership_snapshots_user_id_stream_ordering",
|
||||
table="sliding_sync_membership_snapshots",
|
||||
columns=("user_id", "event_stream_ordering"),
|
||||
replaces_index="sliding_sync_membership_snapshots_user_id",
|
||||
)
|
||||
|
||||
async def get_latest_bump_stamp_for_room(
|
||||
self,
|
||||
room_id: str,
|
||||
|
||||
@ -12,5 +12,5 @@
|
||||
-- <https://www.gnu.org/licenses/agpl-3.0.html>.
|
||||
|
||||
-- So we can fetch all rooms for a given user sorted by stream order
|
||||
DROP INDEX IF EXISTS sliding_sync_membership_snapshots_user_id;
|
||||
CREATE INDEX IF NOT EXISTS sliding_sync_membership_snapshots_user_id ON sliding_sync_membership_snapshots(user_id, event_stream_ordering);
|
||||
INSERT INTO background_updates (ordering, update_name, progress_json) VALUES
|
||||
(9204, 'sliding_sync_membership_snapshots_user_id_stream_ordering', '{}');
|
||||
Loading…
Reference in New Issue
Block a user