summary refs log tree commit diff
path: root/synapse/replication/tcp/resource.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-231-0/+1
| | | | | During the migration the automated script to update the copyright headers accidentally got rid of some of the existing copyright lines. Reinstate them.
* Update license headersPatrick Cloke2023-11-211-10/+16
|
* Fix sending out of order `POSITION` over replication (#16639)Erik Johnston2023-11-161-1/+16
| | | | | If a worker reconnects to Redis we send out the current positions of all our streams. However, if we're also trying to send out a backlog of RDATA at the same time then we can end up sending a `POSITION` with the current token *before* we've sent all the RDATA before the current token. This doesn't cause actual bugs as the receiving servers see the POSITION, fetch the relevant rows from the DB, and then ignore the old RDATA as they come in. However, this is inefficient so it'd be better if we didn't send out-of-order positions
* Reduce replication traffic due to reflected cache stream POSITION (#16557)Erik Johnston2023-10-271-1/+18
|
* Improve logging of replication (#16309)Erik Johnston2023-09-131-1/+6
|
* Fix bug where 5s delays would occasionally happen. (#15150)Erik Johnston2023-02-241-0/+18
| | | This only affects deployments using workers.
* Wait for streams to catch up when processing HTTP replication. (#14820)Erik Johnston2023-01-181-24/+19
| | | | This should hopefully mitigate a class of races where data gets out of sync due a HTTP replication request racing with the replication streams.
* Reduce log spam when running multiple event persisters (#12610)Erik Johnston2022-05-051-0/+9
|
* Improve code documentation for the typing stream over replication. (#12211)reivilibre2022-03-111-3/+3
|
* Rename get_tcp_replication to get_replication_command_handler. (#12192)Patrick Cloke2022-03-101-2/+2
| | | | | | Since the object it returns is a ReplicationCommandHandler. This is clean-up from adding support to Redis where the command handler was added as an additional layer of abstraction from the TCP protocol.
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-1/+1
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Add missing type hints to synapse.replication. (#11938)Patrick Cloke2022-02-081-6/+10
|
* Add missing type hints to `synapse.app`. (#11287)Patrick Cloke2021-11-101-2/+2
|
* Add type hints for most `HomeServer` parameters (#11095)Sean Quah2021-10-221-2/+6
|
* Use direct references for configuration variables (part 6). (#10916)Patrick Cloke2021-09-291-1/+1
|
* Use direct references for some configuration variables (#10798)Patrick Cloke2021-09-131-1/+1
| | | | Instead of proxying through the magic getter of the RootConfig object. This should be more performant (and is more explicit).
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-3/+3
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Don't unnecessarily start bg process in replication sending loop. (#8670)Erik Johnston2020-10-271-0/+10
|
* Make event persisters periodically announce position over replication. (#8499)Erik Johnston2020-10-121-1/+46
| | | | | Currently background proccesses stream the events stream use the "minimum persisted position" (i.e. `get_current_token()`) rather than the vector clock style tokens. This is broadly fine as it doesn't matter if the background processes lag a small amount. However, in extreme cases (i.e. SyTests) where we only write to one event persister the background processes will never make progress. This PR changes it so that the `MultiWriterIDGenerator` keeps the current position of a given instance as up to date as possible (i.e using the latest token it sees if its not in the process of persisting anything), and then periodically announces that over replication. This then allows the "minimum persisted position" to advance, albeit with a small lag.
* Fix typos in comments.Patrick Cloke2020-09-141-1/+1
|
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-1/+1
|
* Have all instances correctly respond to REPLICATE command. (#7475)Erik Johnston2020-05-131-36/+3
| | | | | Before all streams were only written to from master, so only master needed to respond to `REPLICATE` commands. Before all instances wrote to the cache invalidation stream, but didn't respond to `REPLICATE`. This was a bug, which could lead to missed rows from cache invalidation stream if an instance is restarted, however all the caches would be empty in that case so it wasn't a problem.
* Support any process writing to cache invalidation stream. (#7436)Erik Johnston2020-05-071-3/+19
|
* Fix catchup-on-reconnect for the Federation Stream (#7374)Richard van der Hoff2020-05-051-1/+1
| | | | looks like we managed to break this during the refactorathon.
* Run replication streamers on workers (#7146)Erik Johnston2020-04-281-18/+15
| | | Currently we never write to streams from workers, but that will change soon
* Move server command handling out of TCP protocol (#7187)Erik Johnston2020-04-071-137/+26
| | | This completes the merging of server and client command processing.
* Remove connections per replication stream metric. (#7195)Erik Johnston2020-04-011-16/+0
| | | | | This broke in a recent PR (#7024) and is no longer useful due to all replication clients implicitly subscribing to all streams, so let's just remove it.
* Remove usage of "conn_id" for presence. (#7128)Erik Johnston2020-03-301-10/+7
| | | | | | | | | | | | | | | | * Remove `conn_id` usage for UserSyncCommand. Each tcp replication connection is assigned a "conn_id", which is used to give an ID to a remotely connected worker. In a redis world, there will no longer be a one to one mapping between connection and instance, so instead we need to replace such usages with an ID generated by the remote instances and included in the replicaiton commands. This really only effects UserSyncCommand. * Add CLEAR_USER_SYNCS command that is sent on shutdown. This should help with the case where a synchrotron gets restarted gracefully, rather than rely on 5 minute timeout.
* Move catchup of replication streams to worker. (#7024)Erik Johnston2020-03-251-7/+12
| | | 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.
* Remove concept of a non-limited stream. (#7011)Erik Johnston2020-03-201-7/+2
|
* Port PresenceHandler to async/await (#6991)Erik Johnston2020-02-261-1/+5
|
* Propagate cache invalidates from workers to other workers. (#6748)Erik Johnston2020-01-271-3/+6
| | | Currently if a worker invalidates a cache it will be streamed to master, which then didn't forward those to other workers.
* Wake up transaction queue when remote server comes back online (#6706)Erik Johnston2020-01-171-0/+9
| | | | | This will be used to retry outbound transactions to a remote server if we think it might have come back up.
* Port synapse.replication.tcp to async/await (#6666)Erik Johnston2020-01-161-17/+14
| | | | | | | | | | * 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-1/+2
|
* Run Black. (#5482)Amber Brown2019-06-201-20/+34
|
* move FederationStream out to its own fileRichard van der Hoff2019-03-271-1/+2
|
* Fix ClientReplicationStreamProtocol.__str__ (#4929)Richard van der Hoff2019-03-251-1/+0
| | | | | | | | `__str__` depended on `self.addr`, which was absent from ClientReplicationStreamProtocol, so attempting to call str on such an object would raise an exception. We can calculate the peer addr from the transport, so there is no need for addr anyway.
* Add a config option for torture-testing worker replication. (#4902)Richard van der Hoff2019-03-201-1/+17
| | | Setting this to 50 or so makes a bunch of sytests fail in worker mode.
* Wrap a number of things that run in the backgroundRichard van der Hoff2018-07-251-6/+8
| | | | | This will reduce the number of "Starting db connection from sentinel context" warnings, and will help with our metrics.
* run isortAmber Brown2018-07-091-8/+9
|
* Remove all global reactor imports & pass it around explicitly (#3424)Amber Brown2018-06-251-2/+2
|
* Merge remote-tracking branch 'origin/develop' into 3218-official-promAmber Brown2018-05-281-1/+2
|\
| * Merge pull request #3244 from NotAFile/py3-six-4Amber Brown2018-05-241-1/+2
| |\ | | | | | | replace some iteritems with six
| | * replace some iteritems with sixAdrian Tschira2018-05-191-1/+2
| | | | | | | | | | | | Signed-off-by: Adrian Tschira <nota@notafile.com>
* | | more cleanupAmber Brown2018-05-221-3/+4
| | |
* | | cleanups, self-registrationAmber Brown2018-05-221-4/+5
| | |
* | | Merge remote-tracking branch 'origin/develop' into 3218-official-promAmber Brown2018-05-221-0/+2
|\| |
| * | Send users a server notice about consentRichard van der Hoff2018-05-221-0/+2
| |/ | | | | | | | | When a user first syncs, we will send them a server notice asking them to consent to the privacy policy if they have not already done so.
* / rest of the changesAmber Brown2018-05-211-16/+14
|/
* make imports localAdrian Tschira2018-04-281-2/+2
| | | | Signed-off-by: Adrian Tschira <nota@notafile.com>
* Fix some logcontext leaks in replication resourceRichard van der Hoff2017-11-231-2/+4
| | | | | The @measure_func annotations rely on the wrapped function respecting the logcontext rules. Add the necessary yields to make this work.
* replace 'except:' with 'except Exception:'Richard van der Hoff2017-10-231-1/+1
| | | | what could possibly go wrong
* log when we get an exception handling replication updateshera2017-10-121-1/+5
|
* Make workers report to master for user ip updatesErik Johnston2017-06-271-0/+10
|
* Add missing notifierErik Johnston2017-06-091-1/+2
|
* Advance replication streams even if nothing is listeningErik Johnston2017-04-041-1/+1
| | | | | | Otherwise the streams don't advance and steadily fall behind, so when a worker does connect either a) they'll be streamed lots of old updates or b) the connection will fail as the streams are too far behind.
* Always advance stream tokensErik Johnston2017-04-031-1/+4
|
* Use callbacks to notify tcp replication rather than deferredsErik Johnston2017-03-311-14/+1
|
* Add a timestamp to USER_SYNC commandErik Johnston2017-03-311-2/+2
| | | | This timestamp is used to indicate when the user last sync'd
* Add server side resource for tcp replicationErik Johnston2017-03-301-0/+300