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

Commit

Permalink
Add missing ordering to background updates
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
richvdh committed Dec 1, 2020
1 parent ddc4343 commit 38f9b93
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions changelog.d/8850.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add missing `ordering` to background database updates.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
*/

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
-- functionality as the old one. This effectively restarts the background job
-- from the beginning, without running it twice in a row, supporting both
-- upgrade usecases.
INSERT INTO background_updates (update_name, progress_json) VALUES
('populate_stats_process_rooms_2', '{}');
INSERT INTO background_updates (ordering, update_name, progress_json) VALUES
(5812, 'populate_stats_process_rooms_2', '{}');
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
INSERT INTO background_updates (update_name, progress_json) VALUES
('users_have_local_media', '{}');
INSERT INTO background_updates (ordering, update_name, progress_json) VALUES
(5822, 'users_have_local_media', '{}');
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
* limitations under the License.
*/

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

0 comments on commit 38f9b93

Please sign in to comment.