summary refs log tree commit diff
path: root/synapse/replication/tcp/streams/events.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Thread through instance name to replication client. (#7369)Erik Johnston2020-05-011-2/+8
| | | For in memory streams when fetching updates on workers we need to query the source of the stream, which currently is hard coded to be master. This PR threads through the source instance we received via `POSITION` through to the update function in each stream, which can then be passed to the replication client for in memory streams.
* Fix limit logic for EventsStream (#7358)Richard van der Hoff2020-04-291-14/+8
| | | | | | | | | | | | | | | | | | | * Factor out functions for injecting events into database I want to add some more flexibility to the tools for injecting events into the database, and I don't want to clutter up HomeserverTestCase with them, so let's factor them out to a new file. * Rework TestReplicationDataHandler This wasn't very easy to work with: the mock wrapping was largely superfluous, and it's useful to be able to inspect the received rows, and clear out the received list. * Fix AssertionErrors being thrown by EventsStream Part of the problem was that there was an off-by-one error in the assertion, but also the limit logic was too simple. Fix it all up and add some tests.
* Fix EventsStream raising assertions when it falls behindRichard van der Hoff2020-04-241-18/+95
| | | | | | | | | | Figuring out how to correctly limit updates from this stream without dropping entries is far more complicated than just counting the number of rows being returned. We need to consider each query separately and, if any one query hits the limit, truncate the results from the others. I think this also fixes some potentially long-standing bugs where events or state changes could get missed if we hit the limit on either query.
* Improve type checking in `replication.tcp.Stream` (#7291)Richard van der Hoff2020-04-171-7/+9
| | | | | | | The general idea here is to get rid of the type: ignore annotations on all of the current_token and update_function assignments, which would have caught #7290. After a bit of experimentation, it seems like the least-awful way to do this is to pass the offending functions in as parameters to the Stream constructor. Unfortunately that means that the concrete implementations no longer have the same constructor signature as Stream itself, which means that it gets hard to correctly annotate STREAMS_MAP. I've also introduced a couple of new types, to take out some duplication.
* Move catchup of replication streams to worker. (#7024)Erik Johnston2020-03-251-2/+3
| | | This changes the replication protocol so that the server does not send down `RDATA` for rows that happened before the client connected. Instead, the server will send a `POSITION` and clients then query the database (or master out of band) to get up to date.
* Port synapse.replication.tcp to async/await (#6666)Erik Johnston2020-01-161-6/+3
| | | | | | | | | | * Port synapse.replication.tcp to async/await * Newsfile * Correctly document type of on_<FOO> functions as async * Don't be overenthusiastic with the asyncing....
* Fixup synapse.replication to pass mypy checks (#6667)Erik Johnston2020-01-141-5/+11
|
* Replace returnValue with return (#5736)Amber Brown2019-07-231-1/+1
|
* Run Black. (#5482)Amber Brown2019-06-201-18/+14
|
* Fix relations in worker modeErik Johnston2019-05-161-5/+6
|
* Combine the CurrentStateDeltaStream into the EventStreamRichard van der Hoff2019-03-271-1/+33
|
* Make EventStream rows have a typeRichard van der Hoff2019-03-271-12/+86
| | | | ... as a precursor to combining it with the CurrentStateDelta stream.
* move EventsStream out to its own fileRichard van der Hoff2019-03-271-0/+40