diff options
author | Erik Johnston <erik@matrix.org> | 2020-10-09 13:10:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-09 13:10:33 +0100 |
commit | 5009ffcaa45fc3522edc04de2f2b98dc7fe5c59c (patch) | |
tree | e42e6301cd31bba2ea7ff0e2b5ed644f4b871086 /synapse/replication/tcp/streams/_base.py | |
parent | Move additional tasks to the background worker, part 3 (#8489) (diff) | |
download | synapse-5009ffcaa45fc3522edc04de2f2b98dc7fe5c59c.tar.xz |
Only send RDATA for instance local events. (#8496)
When pulling events out of the DB to send over replication we were not filtering by instance name, and so we were sending events for other instances.
Diffstat (limited to 'synapse/replication/tcp/streams/_base.py')
-rw-r--r-- | synapse/replication/tcp/streams/_base.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/synapse/replication/tcp/streams/_base.py b/synapse/replication/tcp/streams/_base.py index 54dccd15a6..61b282ab2d 100644 --- a/synapse/replication/tcp/streams/_base.py +++ b/synapse/replication/tcp/streams/_base.py @@ -240,13 +240,18 @@ class BackfillStream(Stream): ROW_TYPE = BackfillStreamRow def __init__(self, hs): - store = hs.get_datastore() + self.store = hs.get_datastore() super().__init__( hs.get_instance_name(), - current_token_without_instance(store.get_current_backfill_token), - store.get_all_new_backfill_event_rows, + self._current_token, + self.store.get_all_new_backfill_event_rows, ) + def _current_token(self, instance_name: str) -> int: + # The backfill stream over replication operates on *positive* numbers, + # which means we need to negate it. + return -self.store._backfill_id_gen.get_current_token_for_writer(instance_name) + class PresenceStream(Stream): PresenceStreamRow = namedtuple( |