Re: Logical Replication of sequences
От | Nisha Moond |
---|---|
Тема | Re: Logical Replication of sequences |
Дата | |
Msg-id | CABdArM640YF7MQfMVhEX=e1pJdrnVcCwS_y4XXsbvah=6P9S=A@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Logical Replication of sequences (vignesh C <vignesh21@gmail.com>) |
Список | pgsql-hackers |
On Wed, Jul 9, 2025 at 4:11 PM vignesh C <vignesh21@gmail.com> wrote: > > The attached v20250709 version patch has the changes for the same. > Thanks for the patches. In Patch-004: sequencesync.c : I think below function logic can be simplified. +void +ProcessSyncingSequencesForApply(void) +{ + bool started_tx = false; + + Assert(!IsTransactionState()); + + /* Start the sequencesync worker if needed, and there is not one already. */ + foreach_ptr(SubscriptionRelState, rstate, sequence_states_not_ready) + { ... Currently, we loop through all INIT sequences to start a sequencesync worker. But since a single worker handles synchronization for all the sequences in list "sequence_states_not_ready", iterating through the entire list may lead to unnecessary work in cases like: a) when no sync worker slots are available (e.g., nsyncworkers == max_sync_workers_per_subscription), or b) when sequencesync_failure_time hasn't yet elapsed. We could instead check if the list is non-empty (or use a simple bool) and attempt to start the worker. If it can’t be started, we can try again in the next apply loop. Thoughts? -- Thanks. Nisha
В списке pgsql-hackers по дате отправления: