forked-synapse/synapse/replication/slave/storage
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
..
__init__.py Add a slaved events store class 2016-04-06 14:18:35 +01:00
_base.py Fix MultiWriteIdGenerator's handling of restarts. (#8374) 2020-09-24 16:53:51 +01:00
_slaved_id_tracker.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
account_data.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
appservice.py Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
client_ips.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
deviceinbox.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
devices.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
directory.py Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
events.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
filtering.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
groups.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
keys.py Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
presence.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
profile.py Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
push_rule.py Make SlavedIdTracker.advance have same interface as MultiWriterIDGenerator (#8171) 2020-08-26 13:15:20 +01:00
pushers.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
receipts.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
registration.py Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00
room.py Simplify super() calls to Python 3 syntax. (#8344) 2020-09-18 09:56:44 -04:00
transactions.py Rename database classes to make some sense (#8033) 2020-08-05 21:38:57 +01:00