From f0b7b12b5a831073924c5aff7851326e308c3b82 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 8 Apr 2026 16:50:05 -0500 Subject: [PATCH 1/3] Update stream docs to point out `_setup_sequence(...)` in `portdb` --- docs/development/synapse_architecture/streams.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/development/synapse_architecture/streams.md b/docs/development/synapse_architecture/streams.md index 364f90af75d..5ced6eb5d1b 100644 --- a/docs/development/synapse_architecture/streams.md +++ b/docs/development/synapse_architecture/streams.md @@ -158,6 +158,8 @@ These rough notes and links may help you to create a new stream and add all the necessary registration and event handling. **Create your stream:** +- Create a a Postgres-specific database delta file to [add a new `SEQUENCE`](https://github.com/element-hq/synapse/blob/35b55e962aa0bed3b2da5a3c12e3783ddf7604ca/synapse/storage/schema/main/delta/93/01_sticky_events_seq.sql.postgres#L14-L18) (this will be referenced by the `MultiWriterIdGenerator` below). +- Update `synapse/_scripts/synapse_port_db.py` so it knows about your new `SEQUENCE`: [add a new `_setup_sequence(...)`](https://github.com/element-hq/synapse/blob/35b55e962aa0bed3b2da5a3c12e3783ddf7604ca/synapse/_scripts/synapse_port_db.py#L883C24-L888) - [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. From 1b465835970810a964556acbb6dacc94c12c9df7 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 8 Apr 2026 16:58:41 -0500 Subject: [PATCH 2/3] Add changelog --- changelog.d/19675.doc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/19675.doc diff --git a/changelog.d/19675.doc b/changelog.d/19675.doc new file mode 100644 index 00000000000..b93d37bfd96 --- /dev/null +++ b/changelog.d/19675.doc @@ -0,0 +1 @@ +Update developer stream docs for creating a new stream to point out `_setup_sequence(...)` in `portdb`. From fa10d727abf7329ecdf8f533c9346cb48bfeb47a Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 8 Apr 2026 16:59:33 -0500 Subject: [PATCH 3/3] Remove duplicate 'a' --- 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 5ced6eb5d1b..b4057199a93 100644 --- a/docs/development/synapse_architecture/streams.md +++ b/docs/development/synapse_architecture/streams.md @@ -158,7 +158,7 @@ These rough notes and links may help you to create a new stream and add all the necessary registration and event handling. **Create your stream:** -- Create a a Postgres-specific database delta file to [add a new `SEQUENCE`](https://github.com/element-hq/synapse/blob/35b55e962aa0bed3b2da5a3c12e3783ddf7604ca/synapse/storage/schema/main/delta/93/01_sticky_events_seq.sql.postgres#L14-L18) (this will be referenced by the `MultiWriterIdGenerator` below). +- Create a Postgres-specific database delta file to [add a new `SEQUENCE`](https://github.com/element-hq/synapse/blob/35b55e962aa0bed3b2da5a3c12e3783ddf7604ca/synapse/storage/schema/main/delta/93/01_sticky_events_seq.sql.postgres#L14-L18) (this will be referenced by the `MultiWriterIdGenerator` below). - Update `synapse/_scripts/synapse_port_db.py` so it knows about your new `SEQUENCE`: [add a new `_setup_sequence(...)`](https://github.com/element-hq/synapse/blob/35b55e962aa0bed3b2da5a3c12e3783ddf7604ca/synapse/_scripts/synapse_port_db.py#L883C24-L888) - [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)