On Tue, Feb 24, 2026 at 6:49 PM Dilip Kumar <[email protected]> wrote: > > On Tue, Feb 24, 2026 at 4:55 PM Amit Kapila <[email protected]> wrote: > > > > On Tue, Feb 24, 2026 at 4:34 PM Ajin Cherian <[email protected]> wrote: > > > > > > Currently REFRESH SEQUENCES can only be called if the subscription is > > > enabled. All it does is change the states of all the sequences in > > > subscription_rel to INIT, this will prompt the sequence worker to wake > > > up and unconditionally sync all the sequences. For sequences in the > > > INIT state, it doesn't check if there is drift or not, it updates all > > > sequences unconditionally. From your discussions with Dilip, I > > > understand we want to reduce the time it takes to REFRESH SEQUENCES at > > > the time of an upgrade. If so, then this might not be a good approach. > > > > > > > The point I was trying to make is that with automatic sequence sync, > > we won't need to execute REFRESH SEQUENCES before upgrade or failover > > as the sequences will be in sync. > > > > That is a valid goal, however, the sequence sync worker is an > asynchronous process triggered at specific intervals. For a switchover > to guarantee consistency, we must disconnect all connections from the > current publisher and wait for all pending data to sync. Relying on an > automated, interval-based worker at this critical time is risky, as it > directly extends our downtime. To minimize the cutover window, we > should either treat sequence data the same as relational data > (synchronous streaming) or manually trigger for the sequence sync > during the switchover phase, i.e. REFRESH SEQUENCES. Anyway this is > my understanding, do you have anything else in mind that how you are > trying to completely avoid REFRESH SEQUENCES. Having said that I > agree that in many cases where sequences are not frequently modified > it is very much possible that when we are in switchover phase all > sequences are already in sync and if we can identify that then we can > avoid REFRESH SEQUENCES, but my point is we can not completely avoid > that in all caes. >
Right, I am also of the point that we can't completely avoid REFRESH SEQUENCES in all cases. Having sequence sync worker syncing periodically reduces the chances that one need to perform REFRESH SEQUENCES, so we need both. Do we agree with that? Additionally, I am thinking that after sync-worker we change REFRESH SEQUENCES functionality such that it will refresh all sequences during command. And, even we fail to copy one sequence, the command should fail. This should use almost the same functionality (like we sync only the required ones) as syncworker but online. This is because the case where it would be used will be less likely, say when due to some reason like max_logical_workers limit, we are not able to invoke sequencesync worker or just before upgrade (when sequences are not already synced), so doing sync during refresh command sounds reasonable. What do you think? -- With Regards, Amit Kapila.
