Thread

  1. Re: Logical Replication of sequences

    Nisha Moond <nisha.moond412@gmail.com> — 2025-07-10T11:47:17Z

    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