This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set thread_id column to non-null for event_push_{actions,actions_stag…
…ing,summary} (#15437) Updates the database schema to require a thread_id (by adding a constraint that the column is non-null) for event_push_actions, event_push_actions_staging, and event_push_actions_summary. For PostgreSQL we add the constraint as NOT VALID, then VALIDATE the constraint a background job to avoid locking the table during an upgrade. For SQLite we simply rebuild the table & copy the data.
- Loading branch information
Showing
7 changed files
with
225 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Make the `thread_id` column on `event_push_actions`, `event_push_actions_staging`, and `event_push_summary` non-null. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
synapse/storage/schema/main/delta/76/04thread_notifications_backfill.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* Copyright 2023 The Matrix.org Foundation C.I.C | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
-- Force the background updates from 06thread_notifications.sql to run in the | ||
-- foreground as code will now require those to be "done". | ||
|
||
DELETE FROM background_updates WHERE update_name = 'event_push_backfill_thread_id'; | ||
|
||
-- Overwrite any null thread_id values. | ||
UPDATE event_push_actions_staging SET thread_id = 'main' WHERE thread_id IS NULL; | ||
UPDATE event_push_actions SET thread_id = 'main' WHERE thread_id IS NULL; | ||
UPDATE event_push_summary SET thread_id = 'main' WHERE thread_id IS NULL; | ||
|
||
-- Drop the background updates to calculate the indexes used to find null thread_ids. | ||
DELETE FROM background_updates WHERE update_name = 'event_push_actions_thread_id_null'; | ||
DELETE FROM background_updates WHERE update_name = 'event_push_summary_thread_id_null'; |
Oops, something went wrong.