Re: [Patch] add new parameter to pg_replication_origin_session_setup
От | Doruk Yilmaz |
---|---|
Тема | Re: [Patch] add new parameter to pg_replication_origin_session_setup |
Дата | |
Msg-id | CAMPB6weUqU6P2w5VUGVSLKWcvU1AQHmW+7O9qc9yD4CB5kEYVA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [Patch] add new parameter to pg_replication_origin_session_setup (Amit Kapila <amit.kapila16@gmail.com>) |
Список | pgsql-hackers |
On Mon, Jul 29, 2025 at 8:13 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > That is true but I still feel there has to be some mechanism where we > can catch and give an ERROR to the user, if it doesn't follow the > same. For example, pg_replication_origin_advance() always allows going > backwards in terms of LSN which means if one doesn't follow commit > order, it can lead to breaking the replication as after restart the > client can ask to start replication from some prior point. If you have any ideas for safeguards or API changes, I'd be happy to help implement them or discuss them. > Can you tell us the use case? Did you also intend to use it for parallel apply, if so, can you also tell at a high > level, how you are planning to manage origin? Yes, we use it for parallel apply. We have a custom logical replication system that applies changes using multiple worker processes, each with their own database connection. Our use case requires multiple connections to be able to advance the same replication origin. We handle this by having a master process coordinate the workers, where each worker process calls pg_replication_origin_session_setup with the master's PID as the second parameter. We may send operations out of order but we always commit in order, so there's no chance of creating inconsistencies. There's the chance of deadlocks, but these can be detected. It's really similar to the existing parallel apply implementation - the main difference is that we're applying from jsonl files instead of directly from another database. Currently we use a local patch to expose the PID parameter, but having this upstream would be great. It causes a lot of headaches for us to use a patched PostgreSQL. Thanks, Doruk Yılmaz
В списке pgsql-hackers по дате отправления: