On Thu, Feb 19, 2026 at 3:26 AM Peter Smith <[email protected]> wrote: > > 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. >
I am not totally against it, but I don’t find it particularly useful to dump the state (INIT, READY), since we already log exactly which sequences were updated individually (see below). The output below covers both cases—sequences with drift and those in the INIT state. We also include the “no drift” count. So all of these effectively summarizes the overall status. logical replication sync for subscription "sub2", sequence "public.myseq1" has been updated logical replication sync for subscription "sub2", sequence "public.myseq2" has been updated Even if we plan to retain multiple messages for INIT vs READY, I guess, with copy_sequences() now suggested to be called only once irrespective of 'state' will make it further tricky to separate out these log messages for INIT and READY. But let's see. > I think it is useful to discuss how much DEBUG information is > required. However, I would like to know if this is related to the > patch being discussed or a case in HEAD? If later, then it is better > to discuss it separately and address it as a separate patch if > required. Amit, this is related to the new patch only. thanks Shveta
