On Wed, Feb 18, 2026 at 9:05 PM shveta malik <[email protected]> wrote: > ... > 3) > I noticed that copy_sequences is invoked twice per sync cycle—once for > sequences in the INIT state, and once for sequences in the READY state > to detect drift. This means we ping the primary twice during each sync > cycle. We should consider combining this logic into a single > copy_sequences call. Since we already have the state information > (INIT, READY, etc.) for each local sequence, copy_sequences can > internally check the current state and decide whether to transition a > sequence to READY based on its previous state. This approach would > allow us to fetch all required information from the primary in a > single call. > > I also think that we do not even need to mention the states here and > we can give a single message instead of 2: > DEBUG: logical replication sequence synchronization for subscription > "sub1" - for sequences in INIT state batch #1 = 5 attempted, 5 > succeeded, 0 mismatched, 0 insufficient permission, 0 missing from > publisher, 0 skipped, 0 no drift > DEBUG: logical replication sequence synchronization for subscription > "sub1" - for sequences in READY state batch #1 = 5 attempted, 0 > succeeded, 0 mismatched, 0 insufficient permission, 0 missing from > publisher, 0 skipped, 5 no drift >
Those are DEBUG1 messages, not LOG messages, so I think the primary goal is to ensure that they are full of useful information to help debugging. Knowing the prior state information means we know that the "drift" logic was needed when deciding to sync or not. If message volume can be reduced without any loss of debugging usefulness, then great, but we need to take care not to throw the baby out with the bath water. If message volume is a problem, then maybe that should be addressed by using more log levels DEBUG1,DEBUG2,DEBUG3,... etc. ====== Kind Regards, Peter Smith. Fujitsu Australia
