From 220a1a360d919d918c99031d9049763bd4b8532b Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Thu, 30 Apr 2026 12:21:27 +0100 Subject: [PATCH 1/5] Fix `quarantined_media_changes` not being configured for Complement (Although I guess it's not used in there yet, it'd be good to have it set up properly) --- docker/configure_workers_and_start.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docker/configure_workers_and_start.py b/docker/configure_workers_and_start.py index 26c8556eff4..a8822bd9b68 100755 --- a/docker/configure_workers_and_start.py +++ b/docker/configure_workers_and_start.py @@ -517,6 +517,9 @@ def add_worker_roles_to_shared_config( "typing", "push_rules", "thread_subscriptions", + # We can't include `quarantined_media_changes` here + # because the worker type is actually called `media_repository` + # "quarantined_media_changes", } # Worker-type specific sharding config. Now a single worker can fulfill multiple @@ -527,6 +530,13 @@ def add_worker_roles_to_shared_config( if "federation_sender" in worker_types_set: shared_config.setdefault("federation_sender_instances", []).append(worker_name) + if "media_repository" in worker_types_set: + # Handle media_repository being the writer for quarantined_media_changes + # as a special-case + shared_config.setdefault("stream_writers", {}).setdefault( + "quarantined_media_changes", [] + ).append(worker_name) + # Update the list of stream writers. It's convenient that the name of the worker # type is the same as the stream to write. Iterate over the whole list in case there # is more than one. From 5fc36782f60b9e36cb52e7ff7a90f071fdf0f986 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Thu, 30 Apr 2026 12:21:42 +0100 Subject: [PATCH 2/5] Tweak streams cheatsheet --- docs/development/synapse_architecture/streams.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/synapse_architecture/streams.md b/docs/development/synapse_architecture/streams.md index e7ab79091e9..932810350a9 100644 --- a/docs/development/synapse_architecture/streams.md +++ b/docs/development/synapse_architecture/streams.md @@ -163,7 +163,7 @@ necessary registration and event handling. - [create a stream class and stream row class](https://github.com/element-hq/synapse/blob/4367fb2d078c52959aeca0fe6874539c53e8360d/synapse/replication/tcp/streams/_base.py#L728) - will need an [ID generator](https://github.com/element-hq/synapse/blob/4367fb2d078c52959aeca0fe6874539c53e8360d/synapse/storage/databases/main/thread_subscriptions.py#L75) - may need [writer configuration](https://github.com/element-hq/synapse/blob/4367fb2d078c52959aeca0fe6874539c53e8360d/synapse/config/workers.py#L177), if there isn't already an obvious source of configuration for which workers should be designated as writers to your new stream. - - if adding new writer configuration, add Docker-worker configuration, which lets us configure the writer worker in Complement tests: [[1]](https://github.com/element-hq/synapse/blob/4367fb2d078c52959aeca0fe6874539c53e8360d/docker/configure_workers_and_start.py#L331), [[2]](https://github.com/element-hq/synapse/blob/4367fb2d078c52959aeca0fe6874539c53e8360d/docker/configure_workers_and_start.py#L440) + - if adding new writer configuration (`stream_writers`), add Docker-worker configuration, which lets us configure the writer worker in Complement tests: [[1]](https://github.com/element-hq/synapse/blob/4367fb2d078c52959aeca0fe6874539c53e8360d/docker/configure_workers_and_start.py#L331), [[2]](https://github.com/element-hq/synapse/blob/4367fb2d078c52959aeca0fe6874539c53e8360d/docker/configure_workers_and_start.py#L440) - most of the time, you will likely introduce a new datastore class for the concept represented by the new stream, unless there is already an obvious datastore that covers it. - consider whether it may make sense to introduce a handler From eb6a81c39efd391ad771721e475b52b2de7d2a8f Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Thu, 30 Apr 2026 12:25:09 +0100 Subject: [PATCH 3/5] Document `thread_subscriptions` stream_writer --- docs/workers.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/workers.md b/docs/workers.md index 8d3aad19c66..021e1709b9a 100644 --- a/docs/workers.md +++ b/docs/workers.md @@ -576,6 +576,17 @@ configured as stream writer for the `device_lists` stream: ^/_matrix/client/(api/v1|r0|v3|unstable)/keys/device_signing/upload$ ^/_matrix/client/(api/v1|r0|v3|unstable)/keys/signatures/upload$ +##### The `thread_subscriptions` stream + +This stream is only used for MSC4306 (experimental). +It is not used when that experimental feature is disabled. + +The `thread_subscriptions` stream supports multiple writers. +The following endpoints should be routed directly to one of the workers +configured as stream writer for the `thread_subscriptions` stream: + + ^/_matrix/client/unstable/io.element.msc4306/.* + ##### The `quarantined_media_changes` stream The `quarantined_media_changes` stream supports multiple writers. The following endpoints From d4d5b845469effae182b11f768a2fbada9aea9e8 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Thu, 30 Apr 2026 12:25:43 +0100 Subject: [PATCH 4/5] Fix documentation of `quarantined_media_changes` `stream_writer` It doesn't have any internal re-routing, so you can't point those endpoints at any worker (as it said) --- docs/workers.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/workers.md b/docs/workers.md index 021e1709b9a..6ed014e59b0 100644 --- a/docs/workers.md +++ b/docs/workers.md @@ -589,8 +589,7 @@ configured as stream writer for the `thread_subscriptions` stream: ##### The `quarantined_media_changes` stream -The `quarantined_media_changes` stream supports multiple writers. The following endpoints -can be handled by any worker, but should be routed directly to one of the workers +The `quarantined_media_changes` stream supports multiple writers. The following endpoints should be routed directly to one of the workers configured as stream writer for the `quarantined_media_changes` stream: ^/_synapse/admin/v1/quarantine_media/.*$ From a6140b3f41492948839eb5365cd4abb80e078004 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Thu, 30 Apr 2026 12:26:51 +0100 Subject: [PATCH 5/5] Newsfile Signed-off-by: Olivier 'reivilibre --- changelog.d/19746.doc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/19746.doc diff --git a/changelog.d/19746.doc b/changelog.d/19746.doc new file mode 100644 index 00000000000..53e0c13d64d --- /dev/null +++ b/changelog.d/19746.doc @@ -0,0 +1 @@ +Document `thread_subscriptions` stream writer and fix documentation of `quarantined_media_changes` stream writer. \ No newline at end of file