summary refs log tree commit diff
path: root/synapse/replication/tcp/commands.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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>`
* Add type hints for the federation sender. (#9681)Patrick Cloke2021-03-291-3/+3
| | | | Includes an abstract base class which both the FederationSender and the FederationRemoteSendQueue must implement.
* Fix deleting pushers when using sharded pushers. (#9465)Erik Johnston2021-02-221-27/+0
|
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-2/+1
| | | | | | | - 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
* Make event persisters periodically announce position over replication. (#8499)Erik Johnston2020-10-121-10/+26
| | | | | 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.
* Be stricter about JSON that is accepted by Synapse (#8106)Patrick Cloke2020-08-191-7/+5
|
* Reduce unnecessary whitespace in JSON. (#7372)David Vo2020-08-071-2/+3
|
* Add ability to shard the federation sender (#7798)Erik Johnston2020-07-101-4/+6
|
* Fix some spelling mistakes / typos. (#7811)Patrick Cloke2020-07-091-1/+1
|
* Do not use simplejson in Synapse. (#7800)Patrick Cloke2020-07-081-9/+2
|
* Discard RDATA from already seen positions. (#7648)Patrick Cloke2020-06-151-2/+2
|
* Support any process writing to cache invalidation stream. (#7436)Erik Johnston2020-05-071-33/+0
|
* Add instance name to RDATA/POSITION commands (#7364)Erik Johnston2020-04-291-11/+26
| | | | | This is primarily for allowing us to send those commands from workers, but for now simply allows us to ignore echoed RDATA/POSITION commands that we sent (we get echoes of sent commands when using redis). Currently we log a WARNING on the master process every time we receive an echoed RDATA.
* Stop the master relaying USER_SYNC for other workers (#7318)Richard van der Hoff2020-04-221-2/+5
| | | | | | | Long story short: if we're handling presence on the current worker, we shouldn't be sending USER_SYNC commands over replication. In an attempt to figure out what is going on here, I ended up refactoring some bits of the presencehandler code, so the first 4 commits here are non-functional refactors to move this code slightly closer to sanity. (There's still plenty to do here :/). Suggest reviewing individual commits. Fixes (I hope) #7257.
* Another go at fixing one-word commands (#7326)Richard van der Hoff2020-04-221-1/+1
| | | I messed this up last time I tried (#7239 / e13c6c7).
* Add ability to run replication protocol over redis. (#7040)Erik Johnston2020-04-221-0/+18
| | | This is configured via the `redis` config options.
* Fix warnings about not calling superclass constructorRichard van der Hoff2020-04-071-15/+24
| | | | | | Separate `SimpleCommand` from `Command`, so that things which don't want to use the `data` property don't have to, and thus fix the warnings PyCharm was giving me about not calling `__init__` in the base class.
* Remove vestigal references to SYNC replication commandRichard van der Hoff2020-04-071-10/+0
| | | | We've ripped pretty much all of this out: let's remove the remains.
* Remove usage of "conn_id" for presence. (#7128)Erik Johnston2020-03-301-4/+32
| | | | | | | | | | | | | | | | * 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-26/+8
| | | 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.
* Wake up transaction queue when remote server comes back online (#6706)Erik Johnston2020-01-171-0/+17
| | | | | This will be used to retry outbound transactions to a remote server if we think it might have come back up.
* Fixup synapse.replication to pass mypy checks (#6667)Erik Johnston2020-01-141-21/+21
|
* Run Black. (#5482)Amber Brown2019-06-201-23/+48
|
* Fix tightloop over connecting to replication serverErik Johnston2019-02-261-1/+4
| | | | | | | | | | | | | | | If the client failed to process incoming commands during the initial set up of the replication connection it would immediately disconnect and reconnect, resulting in a tightloop. This can happen, for example, when subscribing to a stream that has a row that is too long in the backlog. The fix here is to not consider the connection successfully set up until the client has succesfully subscribed and caught up with the streams. This ensures that the retry logic timers aren't reset until then, meaning that if an error does happen during start up the client will continue backing off before retrying again.
* Logcontexts for replication command handlersRichard van der Hoff2018-08-171-0/+12
| | | | | | | | | | Run the handlers for replication commands as background processes. This should improve the visibility in our metrics, and reduce the number of "running db transaction from sentinel context" warnings. Ideally it means converting the things that fire off deferreds into the night into things that actually return a Deferred when they are done. I've made a bit of a stab at this, but it will probably be leaky.
* Attempt to be more performant on PyPy (#3462)Amber Brown2018-06-281-6/+10
|
* Fix json encoding bug in replicationRichard van der Hoff2018-04-031-1/+1
| | | | json encoders have an encode method, not a dumps method.
* Use static JSONEncodersRichard van der Hoff2018-03-291-3/+5
| | | | | using json.dumps with custom options requires us to create a new JSONEncoder on each call. It's more efficient to create one upfront and reuse it.
* Explicitly use simplejsonErik Johnston2018-03-201-7/+7
|
* Fix replication after switch to simplejsonErik Johnston2018-03-191-2/+4
| | | | | Turns out that simplejson serialises namedtuple's as dictionaries rather than tuples by default.
* Replace ujson with simplejsonErik Johnston2018-03-151-1/+1
|
* Serialize user ip command as jsonErik Johnston2017-06-271-5/+9
|
* Make workers report to master for user ip updatesErik Johnston2017-06-271-0/+32
|
* Add a timestamp to USER_SYNC commandErik Johnston2017-03-311-5/+10
| | | | This timestamp is used to indicate when the user last sync'd
* Initial TCP protocol implementationErik Johnston2017-03-301-0/+341
This defines the low level TCP replication protocol