| From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
|---|---|
| To: | Ajin Cherian <itsajin(at)gmail(dot)com> |
| Cc: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [PATCH] Support automatic sequence replication |
| Date: | 2026-02-24 11:25:20 |
| Message-ID: | CAA4eK1J6zwM1WOnhHR7VYNMAmGiQKf9=KL+Vz+BM3=QuhtL_Lw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Feb 24, 2026 at 4:34 PM Ajin Cherian <itsajin(at)gmail(dot)com> 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.
> As not only does the sequence worker have to update all sequences even
> if they have not drifted, it also has to update the relstate of all
> these sequences to READY. I propose, we change the logic such that
> REFRESH SEQUENCES only wakes up the sequence worker, that will reduce
> the time as most sequences will already be in READY state (unless
> newly added) and only sequences that have not drifted need to be
> updated and no catalog update is required for sequence states already
> in READY state. One downside to this is that, earlier users could
> issue a REFRESH SEQUENCES and wait to see if all the sequences have
> returned to the READY state to confirm that the sync has completed,
> with this approach that advantage is not there. Users might have to
> use a query to find the sequence values of all the sequences and
> compare that with the values in the publisher.
>
Yeah, this point needs more thoughts as the existing method for
REFRESH SEQUENCES also allows users to easily verify if the sequences
are in sync.
--
With Regards,
Amit Kapila.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bertrand Drouvot | 2026-02-24 11:28:11 | Re: PGPROC alignment (was Re: pgsql: Separate RecoveryConflictReasons from procsignals) |
| Previous Message | Ajin Cherian | 2026-02-24 11:04:26 | Re: [PATCH] Support automatic sequence replication |