anonymousland-synapse/synapse/storage/databases/main/schema/delta/58
Erik Johnston f112cfe5bb
Fix MultiWriteIdGenerator's handling of restarts. (#8374)
On startup `MultiWriteIdGenerator` fetches the maximum stream ID for
each instance from the table and uses that as its initial "current
position" for each writer. This is problematic as a) it involves either
a scan of events table or an index (neither of which is ideal), and b)
if rows are being persisted out of order elsewhere while the process
restarts then using the maximum stream ID is not correct. This could
theoretically lead to race conditions where e.g. events that are
persisted out of order are not sent down sync streams.

We fix this by creating a new table that tracks the current positions of
each writer to the stream, and update it each time we finish persisting
a new entry. This is a relatively small overhead when persisting events.
However for the cache invalidation stream this is a much bigger relative
overhead, so instead we note that for invalidation we don't actually
care about reliability over restarts (as there's no caches to
invalidate) and simply don't bother reading and writing to the new table
in that particular case.
2020-09-24 16:53:51 +01:00
..
02remove_dup_outbound_pokes.sql Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
03persist_ui_auth.sql Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
05cache_instance.sql.postgres Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
06dlols_unique_idx.py Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
07add_method_to_thumbnail_constraint.sql.postgres Include method in thumbnail media name (#7124) 2020-09-08 17:19:50 +01:00
07add_method_to_thumbnail_constraint.sql.sqlite Include method in thumbnail media name (#7124) 2020-09-08 17:19:50 +01:00
07persist_ui_auth_ips.sql Allow denying or shadow banning registrations via the spam checker (#8034) 2020-08-20 15:42:58 -04:00
08_media_safe_from_quarantine.sql.postgres Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
08_media_safe_from_quarantine.sql.sqlite Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
09shadow_ban.sql Add a shadow-banned flag to users. (#8092) 2020-08-14 12:37:59 -04:00
10_pushrules_enabled_delete_obsolete.sql Don't remember enabled of deleted push rules and properly return 404 for missing push rules in .../actions and .../enabled (#7796) 2020-09-09 11:39:39 +01:00
10drop_local_rejections_stream.sql Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
10federation_pos_instance_name.sql Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
11user_id_seq.py Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
12room_stats.sql Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
13remove_presence_allow_inbound.sql Remove some unused database functions. (#8085) 2020-08-14 09:25:40 -04:00
14events_instance_name.sql Add experimental support for sharding event persister. Again. (#8294) 2020-09-14 10:16:41 +01:00
14events_instance_name.sql.postgres Add experimental support for sharding event persister. Again. (#8294) 2020-09-14 10:16:41 +01:00
15_catchup_destination_rooms.sql In light of #8255, use BIGINTs for destination_rooms (#8256) 2020-09-04 15:07:29 +01:00
15unread_count.sql Unread counts fixes (#8254) 2020-09-04 14:14:22 +01:00
16populate_stats_process_rooms_fix.sql Rename 'populate_stats_process_rooms_2' background job back to 'populate_stats_process_rooms' again (#8243) 2020-09-08 11:05:59 +01:00
17_catchup_last_successful.sql Catch up after Federation Outage (split, 2): Track last successful stream ordering after transmission (#8247) 2020-09-04 15:06:51 +01:00
18stream_positions.sql Fix MultiWriteIdGenerator's handling of restarts. (#8374) 2020-09-24 16:53:51 +01:00