summary refs log tree commit diff
path: root/tests/replication/slave (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Update code to refer to "workers". (#15606)Patrick Cloke2023-05-164-518/+0
| | | | A bunch of comments and variables are out of date and use obsolete terms.
* Bump ruff from 0.0.252 to 0.0.259 (#15328)dependabot[bot]2023-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Bump ruff from 0.0.252 to 0.0.259 Bumps [ruff](https://github.com/charliermarsh/ruff) from 0.0.252 to 0.0.259. - [Release notes](https://github.com/charliermarsh/ruff/releases) - [Changelog](https://github.com/charliermarsh/ruff/blob/main/BREAKING_CHANGES.md) - [Commits](https://github.com/charliermarsh/ruff/compare/v0.0.252...v0.0.259) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Fix new warnings * Mypy * Newsfile --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Erik Johnston <erik@matrix.org>
* Bump black from 22.12.0 to 23.1.0 (#15103)dependabot[bot]2023-02-221-1/+0
|
* Add missing type hints to tests.replication. (#14987)Patrick Cloke2023-02-062-52/+58
|
* Remove redundant types from comments. (#14412)Patrick Cloke2022-11-161-2/+5
| | | | | | | Remove type hints from comments which have been added as Python type hints. This helps avoid drift between comments and reality, as well as removing redundant information. Also adds some missing type hints which were simple to fill in.
* Merge/remove `Slaved*` stores into `WorkerStores` (#14375)Nick Mills-Barrett2022-11-111-3/+3
|
* Track notification counts per thread (implement MSC3773). (#13776)Patrick Cloke2022-10-041-4/+13
| | | | | | | | When retrieving counts of notifications segment the results based on the thread ID, but choose whether to return them as individual threads or as a single summed field by letting the client opt-in via a sync flag. The summarization code is also updated to be per thread, instead of per room.
* Accept & store thread IDs for receipts (implement MSC3771). (#13782)Patrick Cloke2022-09-231-1/+1
| | | | Updates the `/receipts` endpoint and receipt EDU handler to parse a `thread_id` from the body and insert it in the database.
* Update event push action and receipt tables to support threads. (#13753)Patrick Cloke2022-09-141-0/+1
| | | | | | | | | | | | | | | Adds a `thread_id` column to the `event_push_actions`, `event_push_actions_staging`, and `event_push_summary` tables. This will notifications to be segmented by the thread in a future pull request. The `thread_id` column stores the root event ID or the special value `"main"`. The `thread_id` column for `event_push_actions` and `event_push_summary` is backfilled with `"main"` for all existing rows. New entries into `event_push_actions` and `event_push_actions_staging` will get the proper thread ID. `receipts_linearized` and `receipts_graph` also gain a `thread_id` column, which is similar, except `NULL` is a special value meaning the receipt is "unthreaded". See MSC3771 and MSC3773 for where this data will be useful.
* Remove old empty/redundant slaved stores. (#13349)Nick Mills-Barrett2022-07-212-307/+0
|
* Speed up `get_unread_event_push_actions_by_room` (#13005)Erik Johnston2022-06-151-6/+17
| | | | | | | | | | | Fixes #11887 hopefully. The core change here is that `event_push_summary` now holds a summary of counts up until a much more recent point, meaning that the range of rows we need to count in `event_push_actions` is much smaller. This needs two major changes: 1. When we get a receipt we need to recalculate `event_push_summary` rather than just delete it 2. The logic for deleting `event_push_actions` is now divorced from calculating `event_push_summary`. In future it would be good to calculate `event_push_summary` while we persist a new event (it should just be a case of adding one to the relevant rows in `event_push_summary`), as that will further simplify the get counts logic and remove the need for us to periodically update `event_push_summary` in a background job.
* Rename storage classes (#12913)Erik Johnston2022-05-313-7/+17
|
* Implement changes to MSC2285 (hidden read receipts) (#12168)Šimon Brandner2022-05-041-9/+229
| | | | | * Changes hidden read receipts to be a separate receipt type (instead of a field on `m.read`). * Updates the `/receipts` endpoint to accept `m.fully_read`.
* Use constants for receipt types in tests. (#12582)Šimon Brandner2022-04-281-3/+8
|
* Remove redundant `get_success` calls in test code (#12346)Richard van der Hoff2022-04-011-2/+2
| | | There are a bunch of places we call get_success on an immediate value, which is unnecessary. Let's rip them out, and remove the redundant functionality in get_success and friends.
* Replace assertEquals and friends with non-deprecated versions. (#12092)Patrick Cloke2022-02-281-1/+1
|
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-2/+2
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Make the `get_global_account_data_by_type_for_user` cache be a tree-cache ↵reivilibre2022-01-211-2/+2
| | | | whose key is prefixed with the user ID (#11788)
* Add type hints to event_push_actions. (#11594)Patrick Cloke2021-12-211-3/+4
|
* Do not include rooms with an unknown room version in a sync response. (#10644)Patrick Cloke2021-08-191-0/+1
| | | | A user will still see this room if it is in a local cache, but it will not reappear if clearing the cache and reloading.
* Convert room member storage tuples to attrs. (#10629)Patrick Cloke2021-08-181-3/+6
| | | | Instead of using namedtuples. This helps with asserting type hints and code completion.
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-142-2/+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>`
* Bump black configuration to target py36 (#9781)Dan Callahan2021-04-131-1/+1
| | | Signed-off-by: Dan Callahan <danc@element.io>
* Use mock from the stdlib. (#9772)Patrick Cloke2021-04-091-1/+1
|
* Bugbear: Add Mutable Parameter fixes (#9682)Jonathan de Jong2021-04-081-6/+10
| | | | | | | Part of #9366 Adds in fixes for B006 and B008, both relating to mutable parameter lint errors. Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-1/+4
| | | | | | | - 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
* Add EventStreamPosition type (#8388)Erik Johnston2020-09-241-3/+9
| | | | | | | | | | | | | | The idea is to remove some of the places we pass around `int`, where it can represent one of two things: 1. the position of an event in the stream; or 2. a token that partitions the stream, used as part of the stream tokens. The valid operations are then: 1. did a position happen before or after a token; 2. get all events that happened before or after a token; and 3. get all events between two tokens. (Note that we don't want to allow other operations as we want to change the tokens to be vector clocks rather than simple ints)
* Simplify super() calls to Python 3 syntax. (#8344)Patrick Cloke2020-09-181-1/+1
| | | | | | | This converts calls like super(Foo, self) -> super(). Generated with: sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
* Re-implement unread counts (again) (#8059)Brendan Abolivier2020-09-021-4/+6
|
* Convert push to async/await. (#7948)Patrick Cloke2020-07-271-2/+4
|
* Back out MSC2625 implementation (#7761)Brendan Abolivier2020-07-011-16/+3
|
* LintBrendan Abolivier2020-06-121-3/+1
|
* Test that a mark_unread action updates the right counter when using a slave ↵Brendan Abolivier2020-06-121-0/+15
| | | | store
* Fix testsBrendan Abolivier2020-06-101-3/+3
|
* Performance improvements and refactor of Ratelimiter (#7595)Andrew Morgan2020-06-051-7/+2
| | | | | | | | | | While working on https://github.com/matrix-org/synapse/issues/5665 I found myself digging into the `Ratelimiter` class and seeing that it was both: * Rather undocumented, and * causing a *lot* of config checks This PR attempts to refactor and comment the `Ratelimiter` class, as well as encourage config file accesses to only be done at instantiation. Best to be reviewed commit-by-commit.
* fix mypy for tests/replication (#7518)Richard van der Hoff2020-05-181-11/+5
|
* Clean up replication unit tests. (#7490)Erik Johnston2020-05-132-47/+11
|
* Add instance name to RDATA/POSITION commands (#7364)Erik Johnston2020-04-291-0/+1
| | | | | 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.
* Add ability to run replication protocol over redis. (#7040)Erik Johnston2020-04-221-2/+2
| | | This is configured via the `redis` config options.
* Move client command handling out of TCP protocol (#7185)Erik Johnston2020-04-061-5/+10
| | | 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.
* Read the room version from database when fetching events (#6874)Richard van der Hoff2020-03-041-0/+10
| | | | | This is a precursor to giving EventBase objects the knowledge of which room version they belong to.
* Add a `make_event_from_dict` method (#6858)Richard van der Hoff2020-02-071-4/+8
| | | | | | | ... and use it in places where it's trivial to do so. This will make it easier to pass room versions into the FrozenEvent constructors.
* Add `local_current_membership` table (#6655)Erik Johnston2020-01-151-2/+2
| | | | | | | Currently we rely on `current_state_events` to figure out what rooms a user was in and their last membership event in there. However, if the server leaves the room then the table may be cleaned up and that information is lost. So lets add a table that separately holds that information.
* Add database config class (#6513)Erik Johnston2019-12-181-2/+4
| | | | | This encapsulates config for a given database and is the way to get new connections.
* Fixup testsErik Johnston2019-12-061-1/+4
|
* Implementation of MSC2314 (#6176)Amber Brown2019-11-281-0/+3
|
* Use new EventPersistenceStoreErik Johnston2019-10-232-3/+8
|
* Run Black on the tests again (#5170)Amber Brown2019-05-102-23/+11
|
* Fix sync bug when accepting invites (#4956)Richard van der Hoff2019-04-022-28/+161
| | | | | | | | | | Hopefully this time we really will fix #4422. We need to make sure that the cache on `get_rooms_for_user_with_stream_ordering` is invalidated *before* the SyncHandler is notified for the new events, and we can now do so reliably via the `events` stream.
* Add rate-limiting on registration (#4735)Brendan Abolivier2019-03-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Rate-limiting for registration * Add unit test for registration rate limiting * Add config parameters for rate limiting on auth endpoints * Doc * Fix doc of rate limiting function Co-Authored-By: babolivier <contact@brendanabolivier.com> * Incorporate review * Fix config parsing * Fix linting errors * Set default config for auth rate limiting * Fix tests * Add changelog * Advance reactor instead of mocked clock * Move parameters to registration specific config and give them more sensible default values * Remove unused config options * Don't mock the rate limiter un MAU tests * Rename _register_with_store into register_with_store * Make CI happy * Remove unused import * Update sample config * Fix ratelimiting test for py2 * Add non-guest test
* Clean up event accesses and testsErik Johnston2018-11-021-2/+2
| | | | | This is in preparation to refactor FrozenEvent to support different event formats for different room versions
* Disable frozen dicts by default (#3987)Amber Brown2018-10-021-1/+5
|
* Refactor matrixfederationclient to fix logging (#3906)Richard van der Hoff2018-09-181-32/+3
| | | | | | | | We want to wait until we have read the response body before we log the request as complete, otherwise a confusing thing happens where the request appears to have completed, but we later fail it. To do this, we factor the salient details of a request out to a separate object, which can then keep track of the txn_id, so that it can be logged.
* Fix tests on postgresql (#3740)Amber Brown2018-09-044-124/+116
|
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-08-204-67/+64
|\ | | | | | | erikj/refactor_state_handler
| * Run tests under PostgreSQL (#3423)Amber Brown2018-08-131-0/+1
| |
| * Run black.black2018-08-104-67/+63
| |
* | Fix testsErik Johnston2018-08-091-1/+2
|/
* Fix unit testsRichard van der Hoff2018-07-251-7/+30
| | | | | | on_notifier_poke no longer runs synchonously, so we have to do a different hack to make sure that the replication data has been sent. Let's actually listen for its arrival.
* Fix unit testsErik Johnston2018-07-231-3/+5
|
* run isortAmber Brown2018-07-094-13/+15
|
* remove dead filter_events_for_clientsRichard van der Hoff2018-06-121-8/+0
| | | | | | This is only used by filter_events_for_client, so we can simplify the whole thing by just doing one user at a time, and removing a dead storage function to boot.
* s/replication_client/federation_client/Erik Johnston2018-03-131-1/+1
|
* Fix testsErik Johnston2018-03-131-1/+1
|
* Fix unit testsErik Johnston2018-02-201-4/+6
|
* Remove context.push_actionsErik Johnston2018-02-151-1/+4
|
* Store state groups separately from events (#2784)Erik Johnston2018-02-061-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Split state group persist into seperate storage func * Add per database engine code for state group id gen * Move store_state_group to StateReadStore This allows other workers to use it, and so resolve state. * Hook up store_state_group * Fix tests * Rename _store_mult_state_groups_txn * Rename StateGroupReadStore * Remove redundant _have_persisted_state_group_txn * Update comments * Comment compute_event_context * Set start val for state_group_id_seq ... otherwise we try to recreate old state groups * Update comments * Don't store state for outliers * Update comment * Update docstring as state groups are ints
* Matthew's fixes to the unit testsRichard van der Hoff2018-01-221-2/+6
| | | | Extracted from https://github.com/matrix-org/synapse/pull/2820
* Change slave storage to use new replication interfaceErik Johnston2017-04-031-8/+22
| | | | | | | As the TCP replication uses a slightly different API and streams than the HTTP replication. This breaks HTTP replication.
* Remote membership tests for replicationErik Johnston2017-01-311-43/+0
| | | | | This is because it now relies of the caches stream, which only works on postgres. We are trying to test with sqlite.
* Insert delta of current_state_events to be more efficientErik Johnston2017-01-201-29/+0
|
* Derive current_state_events from state groupsErik Johnston2017-01-201-28/+17
|
* Reduce DB hits for replicationErik Johnston2016-09-231-1/+2
| | | | | | | | | | | | | | Some streams will occaisonally advance their positions without actually having any new rows to send over federation. Currently this means that the token will not advance on the workers, leading to them repeatedly sending a slightly out of date token. This in turns requires the master to hit the DB to check if there are any new rows, rather than hitting the no op logic where we check if the given token matches the current token. This commit changes the API to always return an entry if the position for a stream has changed, allowing workers to advance their tokens correctly.
* Correctly handle the difference between prev and current stateErik Johnston2016-08-311-1/+3
|
* Replace context.current_state with context.current_state_idsErik Johnston2016-08-251-1/+8
|
* Remove room name & alias testDavid Baker2016-06-241-41/+0
| | | | as get_room_name_and_alias is now gone
* Add a slaved datastore for account dataMark Haines2016-05-131-0/+56
|
* Replicate push actionsMark Haines2016-04-211-0/+43
|
* Merge pull request #738 from matrix-org/markjh/slaved_receiptsMark Haines2016-04-193-3/+43
|\ | | | | Add a slaved receipts store
| * Add a slaved receipts storeMark Haines2016-04-193-3/+43
| |
* | Replicate get_invited_rooms_for_userMark Haines2016-04-191-0/+12
|/
* Add tests for redactionsMark Haines2016-04-072-2/+51
|
* Add sensible __eq__ operators inside the tests.Mark Haines2016-04-071-1/+28
| | | | | Rather than adding them globally. This limits the changes to only affect the tests.
* Add tests for get_latest_event_ids_in_room and get_current_stateMark Haines2016-04-071-0/+62
|
* Test that room membership is replicatedMark Haines2016-04-061-8/+63
|
* Add a slaved events store classMark Haines2016-04-064-0/+199
Add a test to check that get_room_names_and_aliases does the same thing on both the master and on the slave data store.