Revert "Redirect event persistence traffic to a particular event persister worker"

Now that things have settled down in the two rooms we special-cased, we
can return the sharding config to normal.

Rich suspects that event_persister-4 being idle was the cause of
federation senders getting stuck on 2023-05-11. It was observed that the
min stream position of RoomStreamTokens was not advancing.

This reverts commit 2263c3bcd7.
matrix-org-hotfixes
Sean Quah 2023-05-12 11:01:57 +01:00
parent 2263c3bcd7
commit 36b72b9f2e
3 changed files with 2 additions and 24 deletions

View File

@ -947,10 +947,6 @@ class ShardedWorkerHandlingConfig:
instances: List[str]
# A map of key to instance name. If any of these keys are used,
# the associated instance is *always* returned.
instances_reserved_for_keys: Dict[str, str] = {}
def should_handle(self, instance_name: str, key: str) -> bool:
"""Whether this instance is responsible for handling the given key."""
# If no instances are defined we assume some other worker is handling
@ -968,10 +964,6 @@ class ShardedWorkerHandlingConfig:
method by default.
"""
reserved_instance = self.instances_reserved_for_keys.get(key)
if reserved_instance is not None:
return reserved_instance
if not self.instances:
raise Exception("Unknown worker")

View File

@ -199,10 +199,7 @@ def find_config_files(search_paths: List[str]) -> List[str]: ...
class ShardedWorkerHandlingConfig:
instances: List[str]
instances_reserved_for_keys: Dict[str, str]
def __init__(
self, instances: List[str], instances_reserved_for_keys: Dict[str, str] = {}
) -> None: ...
def __init__(self, instances: List[str]) -> None: ...
def should_handle(self, instance_name: str, key: str) -> bool: ... # noqa: F811
class RoutableShardedWorkerHandlingConfig(ShardedWorkerHandlingConfig):

View File

@ -272,19 +272,8 @@ class WorkerConfig(Config):
"Must only specify one instance to handle `presence` messages."
)
# Make the event shard config point specific rooms to a specific worker.
# All other rooms should have events persisted by a different worker.
chosen_worker_instance = "event_persister-4"
event_instances = self.writers.events.copy()
event_instances.remove(chosen_worker_instance)
instances_reserved_for_keys = {
"!ioWEdTBHIhOGYVKWyq:libera.chat": chosen_worker_instance,
"!bBgnAGciIvrtPXkHkp:libera.chat": chosen_worker_instance,
}
self.events_shard_config = RoutableShardedWorkerHandlingConfig(
event_instances, instances_reserved_for_keys
self.writers.events
)
# Handle sharded push