summary refs log tree commit diff
path: root/synapse/events/snapshot.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Replace `EventContext` fields `prev_group` and `delta_ids` with field ↵Shay2023-06-131-49/+110
| | | | `state_group_deltas` (#15233)
* Instrument `state` and `state_group` storage related things (tracing) (#15610)Eric Eastwood2023-05-191-0/+5
| | | | | Instrument `state` and `state_group` storage related things (tracing) so it's a little more clear where these database transactions are coming from as there is a lot of wires crossing in these functions. Part of `/messages` performance investigation: https://github.com/matrix-org/synapse/issues/13356
* Use immutabledict instead of frozendict (#15113)David Robertson2023-03-221-2/+2
| | | | | | | | | | Additionally: * Consistently use `freeze()` in test --------- Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de>
* More speedups/fixes to creating batched events (#15195)Shay2023-03-071-0/+1
|
* Batch up storing state groups when creating new room (#14918)Shay2023-02-241-0/+49
|
* Add a class UnpersistedEventContext to allow for the batching up of storing ↵Shay2023-02-091-4/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | state groups (#14675) * add class UnpersistedEventContext * modify create new client event to create unpersistedeventcontexts * persist event contexts after creation * fix tests to persist unpersisted event contexts * cleanup * misc lints + cleanup * changelog + fix comments * lints * fix batch insertion? * reduce redundant calculation * add unpersisted event classes * rework compute_event_context, split into function that returns unpersisted event context and then persists it * use calculate_context_info to create unpersisted event contexts * update typing * $%#^&* * black * fix comments and consolidate classes, use attr.s for class * requested changes * lint * requested changes * requested changes * refactor to be stupidly explicit * clearer renaming and flow * make partial state non-optional * update docstrings --------- Co-authored-by: Erik Johnston <erik@matrix.org>
* Move `StateFilter` to `synapse.types` (#14668)David Robertson2022-12-121-1/+1
| | | | | * Move `StateFilter` to `synapse.types` * Changelog
* Fix docstring in EventContext (#14145)Shay2022-10-181-1/+2
|
* Update type of `EventContext.rejected` (#13460)Richard van der Hoff2022-08-041-4/+3
|
* Rename storage classes (#12913)Erik Johnston2022-05-311-5/+5
|
* Update EventContext `get_current_event_ids` and `get_prev_event_ids` to ↵Shay2022-05-201-4/+15
| | | | accept state filters and update calls where possible (#12791)
* Refactor `EventContext` (#12689)Erik Johnston2022-05-101-145/+32
| | | | | | | | | | Refactor how the `EventContext` class works, with the intention of reducing the amount of state we fetch from the DB during event processing. The idea here is to get rid of the cached `current_state_ids` and `prev_state_ids` that live in the `EventContext`, and instead defer straight to the database (and its caching). One change that may have a noticeable effect is that we now no longer prefill the `get_current_state_ids` cache on a state change. However, that query is relatively light, since its just a case of reading a table from the DB (unlike fetching state at an event which is more heavyweight). For deployments with workers this cache isn't even used. Part of #12684
* Add some type hints to datastore. (#12477)Dirk Klimpel2022-05-101-1/+2
|
* Faster joins: persist to database (#12012)Richard van der Hoff2022-03-011-0/+9
| | | | | | | | | | | | When we get a partial_state response from send_join, store information in the database about it: * store a record about the room as a whole having partial state, and stash the list of member servers too. * flag the join event itself as having partial state * also, for any new events whose prev-events are partial-stated, note that they will *also* be partial-stated. We don't yet make any attempt to interpret this data, so API calls (and a bunch of other things) are just going to get incorrect data.
* Add `FrozenEvent.get_state_key` and use it in a couple of places (#11793)Richard van der Hoff2022-01-211-1/+1
| | | | This is more efficient, since we only have to look up `state_key` in the event dict once, rather than three (!) times.
* Use auto_attribs/native type hints for attrs classes. (#11692)Patrick Cloke2022-01-131-9/+9
|
* Fix using MSC2716 batch sending with event persistence workers (#11220)Tulir Asokan2021-11-291-0/+5
| | | | Signed-off-by: Tulir Asokan <tulir@beeper.com>
* Add type hints to synapse.events.*. (#11066)Patrick Cloke2021-10-131-50/+60
| | | Except `synapse/events/__init__.py`, which will be done in a follow-up.
* Factor out a separate `EventContext.for_outlier` (#10883)Richard van der Hoff2021-09-221-4/+10
| | | | | | Constructing an EventContext for an outlier is actually really simple, and there's no sense in going via an `async` method in the `StateHandler`. This also means that we can resolve a bunch of FIXMEs.
* 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-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
* Rename database classes to make some sense (#8033)Erik Johnston2020-08-051-1/+1
|
* Convert a synapse.events to async/await. (#7949)Patrick Cloke2020-07-271-24/+22
|
* Replace iteritems/itervalues/iterkeys with native versions. (#7692)Patrick Cloke2020-06-151-3/+1
|
* Fix bug in EventContext.deserialize. (#7393)Erik Johnston2020-05-051-2/+5
| | | | This caused `prev_state_ids` to be incorrect if the state event was not replacing an existing state entry.
* Add StateMap type alias (#6715)Erik Johnston2020-01-161-6/+5
|
* Change EventContext to use the Storage class (#6564)Erik Johnston2019-12-201-15/+21
|
* Fix bug which caused rejected events to be stored with the wrong room state ↵Richard van der Hoff2019-11-061-2/+23
| | | | | | | | | | | | (#6320) Fixes a bug where rejected events were persisted with the wrong state group. Also fixes an occasional internal-server-error when receiving events over federation which are rejected and (possibly because they are backwards-extremities) have no prev_group. Fixes #6289.
* Add some checks that we aren't using state from rejected events (#6330)Richard van der Hoff2019-11-051-5/+44
| | | | | | | | | | | | | * Raise an exception if accessing state for rejected events Add some sanity checks on accessing state_group etc for rejected events. * Skip calculating push actions for rejected events It didn't actually cause any bugs, because rejected events get filtered out at various later points, but there's not point in trying to calculate the push actions for a rejected event.
* Improve documentation for EventContext fields (#6319)Richard van der Hoff2019-11-051-26/+65
|
* Factor out an _AsyncEventContextImpl (#6298)Richard van der Hoff2019-11-011-65/+42
| | | | | | The intention here is to make it clearer which fields we can expect to be populated when: notably, that the _event_type etc aren't used for the synchronous impl of EventContext.
* Convert EventContext to attrs (#6218)Richard van der Hoff2019-10-281-61/+39
| | | | * make EventContext use an attr
* Replace returnValue with return (#5736)Amber Brown2019-07-231-15/+13
|
* 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-25/+24
|
* Do checks on aliases for incoming m.room.aliases events (#5128)Brendan Abolivier2019-05-081-2/+6
| | | | | Follow-up to #5124 Also added a bunch of checks to make sure everything (both the stuff added on #5124 and this PR) works as intended.
* Handle delta_ids being None in _update_context_for_auth_eventsRichard van der Hoff2018-07-231-1/+2
| | | | | | | it's easier to create the new state group as a delta from the existing one. (There's an outside chance this will help with https://github.com/matrix-org/synapse/issues/3364)
* CommentsErik Johnston2018-07-231-2/+3
|
* Only get cached state from context in persist_eventErik Johnston2018-07-231-0/+13
| | | | | | We don't want to bother pulling out the current state from the DB since until we know we have to. Checking the context for state is just an optimisation.
* Fix missing attributes on workers.Erik Johnston2018-07-231-4/+6
| | | | | This was missed during the transition from attribute to getter for getting state from context.
* Fix EventContext when using workersErik Johnston2018-07-231-7/+7
| | | | | | We were: 1. Not correctly setting all attributes 2. Using defer.inlineCallbacks in a non-generator
* Update docstrings to make senseErik Johnston2018-07-231-5/+8
|
* Add support for updating stateErik Johnston2018-07-231-0/+19
|
* Make EventContext lazy load stateErik Johnston2018-07-231-41/+112
|
* pep8Erik Johnston2018-07-231-1/+1
|
* Refcator EventContext to accept state during initErik Johnston2018-07-231-21/+27
|
* Make the rest of the .iterwhatever go away (#3562)Amber Brown2018-07-211-1/+3
|
* run isortAmber Brown2018-07-091-2/+2
|
* Remove context.push_actionsErik Johnston2018-02-151-4/+0
|
* Don't serialize current state over replicationErik Johnston2018-02-151-6/+35
|
* Add replication http endpoint for event sendingErik Johnston2018-02-071-0/+72
|
* Store state groups separately from events (#2784)Erik Johnston2018-02-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Add more granular event send metricsErik Johnston2017-05-021-0/+3
|
* Refactoring and cleanupsRichard van der Hoff2017-03-171-0/+26
| | | | | | | | | | | | A few non-functional changes: * A bunch of docstrings to document types * Split `EventsStore._persist_events_txn` up a bit. Hopefully it's a bit more readable. * Rephrase `EventFederationStore._update_min_depth_for_room_txn` to avoid mind-bending conditional. * Rephrase rejected/outlier conditional in `_update_outliers_txn` to avoid mind-bending conditional.
* Add commentsErik Johnston2016-09-051-0/+5
|
* Move to storing state_groups_state as deltasErik Johnston2016-09-011-0/+16
|
* Correctly handle the difference between prev and current stateErik Johnston2016-08-311-2/+3
|
* Replace context.current_state with context.current_state_idsErik Johnston2016-08-251-11/+2
|
* Pull out event ids rather than full events for stateErik Johnston2016-08-251-0/+8
|
* Atomically persit push actions when we persist the eventErik Johnston2016-02-091-0/+1
|
* copyrightsMatthew Hodgson2016-01-071-1/+1
|
* Remove concept of context.auth_events, instead use context.current_stateErik Johnston2015-03-161-2/+1
|
* Add support for storing rejected events in EventContext and data storesErik Johnston2015-01-221-0/+1
|
* Update copyright noticesMark Haines2015-01-061-1/+1
|
* Remove unused functionsErik Johnston2014-12-151-42/+0
|
* Various typos and bug fixes.Erik Johnston2014-12-081-1/+2
|
* WIP for new way of managing events.Erik Johnston2014-12-031-0/+63