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

Commit 38f9b93

Browse files
committed
Add missing ordering to background updates
It's important that we make sure our background updates happen in a defined order, to avoid disasters like #6923. Add an ordering to all of the background updates that have landed since #7190.
1 parent ddc4343 commit 38f9b93

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

changelog.d/8850.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add missing `ordering` to background database updates.

synapse/storage/databases/main/schema/delta/58/07add_method_to_thumbnail_constraint.sql.postgres

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
*/
2121

2222
-- add new index that includes method to local media
23-
INSERT INTO background_updates (update_name, progress_json) VALUES
24-
('local_media_repository_thumbnails_method_idx', '{}');
23+
INSERT INTO background_updates (ordering, update_name, progress_json) VALUES
24+
(5805, 'local_media_repository_thumbnails_method_idx', '{}');
2525

2626
-- add new index that includes method to remote media
27-
INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
28-
('remote_media_repository_thumbnails_method_idx', '{}', 'local_media_repository_thumbnails_method_idx');
27+
INSERT INTO background_updates (ordering, update_name, progress_json, depends_on) VALUES
28+
(5805, 'remote_media_repository_thumbnails_method_idx', '{}', 'local_media_repository_thumbnails_method_idx');
2929

3030
-- drop old index
31-
INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
32-
('media_repository_drop_index_wo_method', '{}', 'remote_media_repository_thumbnails_method_idx');
31+
INSERT INTO background_updates (ordering, update_name, progress_json, depends_on) VALUES
32+
(5805, 'media_repository_drop_index_wo_method', '{}', 'remote_media_repository_thumbnails_method_idx');
3333

synapse/storage/databases/main/schema/delta/58/12room_stats.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
-- functionality as the old one. This effectively restarts the background job
2929
-- from the beginning, without running it twice in a row, supporting both
3030
-- upgrade usecases.
31-
INSERT INTO background_updates (update_name, progress_json) VALUES
32-
('populate_stats_process_rooms_2', '{}');
31+
INSERT INTO background_updates (ordering, update_name, progress_json) VALUES
32+
(5812, 'populate_stats_process_rooms_2', '{}');
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
INSERT INTO background_updates (update_name, progress_json) VALUES
2-
('users_have_local_media', '{}');
1+
INSERT INTO background_updates (ordering, update_name, progress_json) VALUES
2+
(5822, 'users_have_local_media', '{}');

synapse/storage/databases/main/schema/delta/58/23e2e_cross_signing_keys_idx.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
* limitations under the License.
1414
*/
1515

16-
INSERT INTO background_updates (update_name, progress_json) VALUES
17-
('e2e_cross_signing_keys_idx', '{}');
16+
INSERT INTO background_updates (ordering, update_name, progress_json) VALUES
17+
(5823, 'e2e_cross_signing_keys_idx', '{}');

0 commit comments

Comments
 (0)