Re: [PATCH] Support automatic sequence replication

From: Ajin Cherian <itsajin(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(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-26 07:37:08
Message-ID: CAFPTHDYud1zr0VyizhyhEQXfHMgXVcHrPzE56WUKGCFNskQq2A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 24, 2026 at 5:17 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> Can we find some cheap
> way to detect if sequencesync worker is present or not? Can you think
> some other way to not incur the cost of traversing the worker array
> and also detect sequence worker exit without much delay?
>

Added this.

> Also, shouldn't we need to invoke AcceptInvalidationMessages() as we
> are doing in apply worker when not in a remote transaction? I think it
> will be required to get local_sequence definition changes , if any.

Changed.

Thanks Hou-san for helping me with these changes.
I also did some performance testing on HEAD to see how long REFRESH
SEQUENCES takes for a large number of sequences.
I ran these on a 2× Intel Xeon E5-2699 v4 (22 cores each, 44 cores
total / 88 threads) 512 GB RAM. I didn't see much value in
differentiating between cases where half the sequences were different
or all the sequences were different as REFRESH SEQUENCES updates all
sequences after changing the state of all of them to INIT, it doesn't
matter if they drifted or not.

On HEAD:
time to sync 10000 sequences: 1.080s (1080ms)
time to sync 100000 sequences: 12.069s (12069ms)
time to sync 1000000 sequences: 139.414s (139414ms)

testing script attached (pass in the number of sequences as a run time
parameter).

regards,
Ajin Cherian
Fujitsu Australia

Attachment Content-Type Size
v7-0001-Support-automatic-sequence-replication.patch application/octet-stream 39.4 KB
test_seq_sync_performance.zip application/x-zip-compressed 2.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Sharma 2026-02-26 07:42:06 Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication
Previous Message wenhui qiu 2026-02-26 07:32:31 Re: [PROPOSAL] Doublewrite Buffer as an alternative torn page protection to Full Page Write