-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Resume state re-syncing after a Synapse restart #12771
Conversation
… returns an invalid response Signed-off-by: Sean Quah <seanq@matrix.org>
Signed-off-by: Sean Quah <seanq@matrix.org>
Signed-off-by: Sean Quah <seanq@matrix.org>
room_id: room to be resynced | ||
""" | ||
assert not self.config.worker.worker_app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is implied by the identical assert in do_invite_join
, which starts the background task.
destination: Optional[str], | ||
destinations: Collection[str], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not see a simple way to determine the destination
the original sync was using after a restart, so I took the entire list of servers in the room to try.
# Make an infinite iterator of destinations to try. Once we find a working | ||
# destination, we'll stick with it until it flakes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a restart, it might take a little time before we stumble upon a working remote server. Can we do better?
if attempt == num_destinations - 1: | ||
# We have tried every remote server. Give up. | ||
logger.error( | ||
"Failed to get state for %s at %s from %s because %s. " | ||
"Giving up!", | ||
room_id, | ||
event, | ||
destination, | ||
e, | ||
) | ||
raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure about what to do if we've tried every destination and none of them worked.
run_as_background_process( | ||
desc="sync_partial_state_room", | ||
func=self._sync_partial_state_room, | ||
destination=None, | ||
destinations=servers_in_room, | ||
room_id=room_id, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be useful to append the room ID to desc
? Otherwise all the logging contexts will be labelled sync_partial_state_room-[0-9]+
I'm going to split this into two PRs, one for trying other homeservers and the other for resuming re-sync of state. |
Resolves #12642.
These changes haven't been tested at all. How would we go about testing?