diff --git a/synapse/storage/prepare_database.py b/synapse/storage/prepare_database.py index 2b323c0272..83993cb969 100644 --- a/synapse/storage/prepare_database.py +++ b/synapse/storage/prepare_database.py @@ -589,8 +589,13 @@ def _clear_out_of_date_sliding_sync_tables( `sliding_sync_joined_rooms`/`sliding_sync_membership_snapshots` tables. This accounts for when someone downgrades their Synapse version and then upgrades it - again. This will ensure that we don't have any out-of-date data in the - `sliding_sync_joined_rooms`/`sliding_sync_membership_snapshots` tables. + again. This will ensure that we don't have any out-of-date/stale data in the + `sliding_sync_joined_rooms`/`sliding_sync_membership_snapshots` tables since any new + events sent in rooms would have also needed to be written to the sliding sync + tables. For example a new event needs to bump `event_stream_ordering` in + `sliding_sync_joined_rooms` table or some state in the room changing (like the room + name). Or another example of someone's membership changing in a room affecting + `sliding_sync_membership_snapshots`. FIXME: This can be removed once we bump `SCHEMA_COMPAT_VERSION` and run the foreground update for @@ -609,8 +614,11 @@ def _clear_out_of_date_sliding_sync_joined_rooms_table( Clears out-of-date entries from the `sliding_sync_joined_rooms` table. This accounts for when someone downgrades their Synapse version and then upgrades it - again. This will ensure that we don't have any out-of-date data in the - `sliding_sync_joined_rooms` table. + again. This will ensure that we don't have any out-of-date/stale data in the + `sliding_sync_joined_rooms` table since any new events sent in rooms would have also + needed to be written to the `sliding_sync_joined_rooms` table or some state in the + room changing (like the room name). For example a new event needs to bump + `event_stream_ordering` in `sliding_sync_joined_rooms`. FIXME: This can be removed once we bump `SCHEMA_COMPAT_VERSION` and run the foreground update for @@ -672,8 +680,10 @@ def _clear_out_of_date_sliding_sync_membership_snapshots_table( Clears out-of-date entries from the `sliding_sync_membership_snapshots` table. This accounts for when someone downgrades their Synapse version and then upgrades it - again. This will ensure that we don't have any out-of-date data in the - `sliding_sync_membership_snapshots` table. + again. This will ensure that we don't have any out-of-date/stale data in the + `sliding_sync_membership_snapshots` table since any new membership changes in rooms + would have also needed to be written to the `sliding_sync_membership_snapshots` + table. FIXME: This can be removed once we bump `SCHEMA_COMPAT_VERSION` and run the foreground update for