summary refs log tree commit diff
path: root/synapse/replication/tcp/protocol.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Don't relay REMOTE_SERVER_UP cmds to same conn. (#7352)Erik Johnston2020-04-291-1/+1
| | | | | | | | | | | | | | For direct TCP connections we need the master to relay REMOTE_SERVER_UP commands to the other connections so that all instances get notified about it. The old implementation just relayed to all connections, assuming that sending back to the original sender of the command was safe. This is not true for redis, where commands sent get echoed back to the sender, which was causing master to effectively infinite loop sending and then re-receiving REMOTE_SERVER_UP commands that it sent. The fix is to ensure that we only relay to *other* connections and not to the connection we received the notification from. Fixes #7334.
* Fix replication metrics when using redis (#7325)Erik Johnston2020-04-221-36/+16
|
* Add ability to run replication protocol over redis. (#7040)Erik Johnston2020-04-221-26/+12
| | | This is configured via the `redis` config options.
* Handle one-word replication commands correctlyRichard van der Hoff2020-04-071-3/+11
| | | | | `REPLICATE` is now a valid command, and it's nice if you can issue it from the console without remembering to call it `REPLICATE ` with a trailing space.
* Move server command handling out of TCP protocol (#7187)Erik Johnston2020-04-071-114/+51
| | | This completes the merging of server and client command processing.
* Move client command handling out of TCP protocol (#7185)Erik Johnston2020-04-061-166/+31
| | | The aim here is to move the command handling out of the TCP protocol classes and to also merge the client and server command handling (so that we can reuse them for redis protocol). This PR simply moves the client paths to the new `ReplicationCommandHandler`, a future PR will move the server paths too.
* Remove usage of "conn_id" for presence. (#7128)Erik Johnston2020-03-301-2/+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-135/+71
| | | 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.
* Propagate cache invalidates from workers to other workers. (#6748)Erik Johnston2020-01-271-1/+1
| | | 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/+15
| | | | | 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-40/+32
| | | | | | | | | | * 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-15/+21
|
* document the REPLICATE command a bit better (#6305)Richard van der Hoff2019-11-041-2/+72
| | | | since I found myself wonder how it works
* Remove usage of deprecated logger.warn method from codebase (#6271)Andrew Morgan2019-10-311-1/+1
| | | Replace every instance of `logger.warn` with `logger.warning` as the former is deprecated.
* Move logging utilities out of the side drawer of util/ and into logging/ (#5606)Amber Brown2019-07-041-1/+1
|
* Run Black. (#5482)Amber Brown2019-06-201-37/+39
|
* Make EventStream rows have a typeRichard van der Hoff2019-03-271-2/+2
| | | | ... as a precursor to combining it with the CurrentStateDelta stream.
* Add parse_row method to replication stream classRichard van der Hoff2019-03-271-1/+1
| | | | This will allow individual stream classes to override how a row is parsed.
* Fix ClientReplicationStreamProtocol.__str__ (#4929)Richard van der Hoff2019-03-251-3/+5
| | | | | | | | `__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.
* Fix bug where read-receipts lost their timestamps (#4927)Richard van der Hoff2019-03-251-8/+19
| | | | | Make sure that they are sent correctly over the replication stream. Fixes: #4898
* Simplify token replication logicAndrew Morgan2019-03-051-23/+14
|
* Clean up logic and add commentsAndrew Morgan2019-03-041-11/+18
|
* Clearer branching, fix missing list clearAndrew Morgan2019-03-041-4/+11
|
* Prevent replication wedgingAndrew Morgan2019-03-041-4/+24
|
* Merge pull request #4749 from matrix-org/erikj/replication_connection_backoffErik Johnston2019-02-271-0/+17
|\ | | | | Fix tightloop over connecting to replication server
| * Move connecting logic into ClientReplicationStreamProtocolErik Johnston2019-02-271-0/+17
| |
* | Limit cache invalidation replication line length (#4748)Erik Johnston2019-02-271-1/+16
|/
* Don't truncate command name in metricsErik Johnston2018-10-291-2/+2
|
* Remove conn_idErik Johnston2018-09-041-2/+2
|
* Remove conn_id from repl prometheus metricsErik Johnston2018-09-031-10/+10
| | | | | `conn_id` gets set to a random string, and so we end up filling up prometheus with tonnes of data series, which is bad.
* Logcontexts for replication command handlersRichard van der Hoff2018-08-171-13/+29
| | | | | | | | | | 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.
* run isortAmber Brown2018-07-091-16/+24
|
* Fix tcp protocol metrics naming (#3410)Amber Brown2018-06-211-18/+35
|
* Fix replication metricsRichard van der Hoff2018-06-041-2/+2
| | | | fix bug introduced in #3256
* Merge remote-tracking branch 'origin/develop' into 3218-official-promAmber Brown2018-05-281-7/+7
|\
| * replace some iteritems with sixAdrian Tschira2018-05-191-4/+5
| | | | | | | | Signed-off-by: Adrian Tschira <nota@notafile.com>
* | more cleanupAmber Brown2018-05-221-3/+6
| |
* | fix the test failuresAmber Brown2018-05-221-1/+1
| |
* | replacing portionsAmber Brown2018-05-211-54/+34
|/
* make imports localAdrian Tschira2018-04-281-2/+2
| | | | Signed-off-by: Adrian Tschira <nota@notafile.com>
* Metrics for number of RDATA commands receivedRichard van der Hoff2018-01-151-5/+14
| | | | I found myself wishing we had this.
* Reduce log levels in tcp replicationErik Johnston2017-07-111-2/+2
|
* Make workers report to master for user ip updatesErik Johnston2017-06-271-0/+6
|
* TypoErik Johnston2017-04-101-1/+1
|
* Up replication ping timeoutErik Johnston2017-04-101-2/+4
|
* Add log linesErik Johnston2017-04-051-1/+2
|
* Rearrange metricsErik Johnston2017-04-051-16/+31
|
* Fix typoErik Johnston2017-04-051-2/+2
|
* Fixup some metrics for tcp replErik Johnston2017-04-051-0/+16
|
* Merge pull request #2098 from matrix-org/erikj/repl_tcp_fixErik Johnston2017-04-041-5/+7
|\ | | | | Advance replication streams even if nothing is listening
| * Advance replication streams even if nothing is listeningErik Johnston2017-04-041-5/+7
| | | | | | | | | | | | 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.
* | Fiddle tcp replication loggingErik Johnston2017-04-041-2/+2
|/
* Add a timestamp to USER_SYNC commandErik Johnston2017-03-311-2/+5
| | | | This timestamp is used to indicate when the user last sync'd
* Initial TCP protocol implementationErik Johnston2017-03-301-0/+601
This defines the low level TCP replication protocol