-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add support to purge rows from MSC2716 and other tables when purging a room #13825
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -419,6 +419,7 @@ def _purge_room_txn(self, txn: LoggingTransaction, room_id: str) -> List[int]: | |
"event_forward_extremities", | ||
"event_push_actions", | ||
"event_search", | ||
"event_failed_pull_attempts", | ||
"partial_state_events", | ||
"events", | ||
"federation_inbound_events_staging", | ||
|
@@ -441,6 +442,10 @@ def _purge_room_txn(self, txn: LoggingTransaction, room_id: str) -> List[int]: | |
"e2e_room_keys", | ||
"event_push_summary", | ||
"pusher_throttle", | ||
"insertion_events", | ||
"insertion_event_extremities", | ||
"insertion_event_edges", | ||
"batch_events", | ||
Comment on lines
+445
to
+448
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Comment on lines
+445
to
+448
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just asking the question in case, Is there a reason why we wouldn't want to purge related data for a room when deleting the room? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe for keeping some kind of audit logs, maybe? Or perhaps you want to kick everyone for a room but keep its content, e.g. to determine what information has been leaked? (Pure speculation) |
||
"room_account_data", | ||
"room_tags", | ||
# "rooms" happens last, to keep the foreign keys in the other tables | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* Copyright 2022 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. | ||
*/ | ||
|
||
-- Add index so we can easily purge all rows from a given `room_id` | ||
CREATE INDEX IF NOT EXISTS event_failed_pull_attempts_room_id ON event_failed_pull_attempts(room_id); | ||
|
||
-- MSC2716 related tables: | ||
-- Add indexes so we can easily purge all rows from a given `room_id` | ||
CREATE INDEX IF NOT EXISTS insertion_events_room_id ON insertion_events(room_id); | ||
CREATE INDEX IF NOT EXISTS batch_events_room_id ON batch_events(room_id); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other tables added to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in #13589
This one even has a foreign key for the
room_id
which would be wrecked if we delete the room as we do below.