This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Pull out less state when handling gaps mk2 #12852
Merged
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
99b350e
Change compute_event_context to take state_ids
erikjohnston 05474e9
Change _process_received_pdu
erikjohnston 35a4614
Change _resolve_state_at_missing_prevs
erikjohnston ea9063d
Add a get_metadata_for_events DB func
erikjohnston 7a9586e
_get_state_after_missing_prev_event
erikjohnston 37b9c33
Change MessageHandler
erikjohnston 0fe4092
Fix tests
erikjohnston 9376b9a
Newsfile
erikjohnston 71907fd
Fix tests
erikjohnston f9ba81b
Apply suggestions from code review
erikjohnston edcd824
Code review comments
erikjohnston 72a783e
Merge remote-tracking branch 'origin/develop' into erikj/less_state_o…
erikjohnston 4343d35
Update synapse/storage/databases/main/state.py
erikjohnston a593b2d
Merge remote-tracking branch 'origin/develop' into erikj/less_state_o…
erikjohnston 9e43239
Fix style
erikjohnston File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1022,12 +1022,24 @@ async def create_new_client_event( | |
| # | ||
| # TODO(faster_joins): figure out how this works, and make sure that the | ||
| # old state is complete. | ||
| old_state = await self.store.get_events_as_list(state_event_ids) | ||
| metadata = await self.store.get_metadata_for_events(state_event_ids) | ||
|
|
||
| state_map = {} | ||
| for state_id in state_event_ids: | ||
| data = metadata.get(state_id) | ||
| if data is None: | ||
| raise Exception("State event not persisted %s", state_id) | ||
|
erikjohnston marked this conversation as resolved.
Outdated
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be good to add some more comments, and/or improve the exception message here. What exactly does it mean? Somebody is trying to send an insertion event which refers to a state event which we haven't (yet?) seen? Is there a mechanism to pull said event which has failed, or is this a client-side error?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have added a comment to try and address those questions, hopefully it makes sense now? edcd824#diff-3d4a81fcc5b115c649ae67aaba0dd4dd0c5827bb001dfcb90b00ffb1605d518eR1038-R1048 |
||
|
|
||
| if data.state_key is None: | ||
| raise Exception( | ||
| "Trying to set non-state event as state: %s", state_id | ||
| ) | ||
|
erikjohnston marked this conversation as resolved.
|
||
|
|
||
| state_map[(data.event_type, data.state_key)] = state_id | ||
|
|
||
| context = await self.state.compute_event_context( | ||
| event, | ||
| state_ids_before_event={ | ||
| (e.type, e.state_key): e.event_id for e in old_state | ||
| }, | ||
| state_ids_before_event=state_map, | ||
| ) | ||
| else: | ||
| context = await self.state.compute_event_context(event) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.