Hi,

On Wed, Apr 15, 2026 at 12:17 PM shveta malik <[email protected]> wrote:
>
> On Wed, Apr 15, 2026 at 12:00 PM Ashutosh Sharma <[email protected]> 
> wrote:
> >
> >
> > On Wed, Apr 15, 2026 at 11:09 AM shveta malik <[email protected]> 
> > wrote:
> > >
> > > With this, 'FIRST 1(standby_1, standby_2)' is convered to wait_for_all
> > > mode, which is not correct and it keeps wiating for standby_2 when
> > > standby_1 has already taken changes. I am not sure what is correct way
> > > to deal with it when it comes to first patch alone. My expectation was
> > > that FIRST-syntax is blocked i.e. it errors out instead of partially
> > > implemented and misbehaving. But if we plan to do so, the challenge
> > > will be how to distinguish actual FIRST and comma separated list
> > > implicitly converted to 'FIRST 1' by syncrep parser. For that we will
> > > need either 003 or IsPrioritySyncStandbySlotsSyntax', thus defeating
> > > the whole purpose of separating the patches. What do you think on
> > > this? 001 is okay as is or we shall block FIRST?
> > >
> >
> > AFAICS, we should first finalize the synchronous replication parser
> > changes to give an identity to the plain list mode. Once that is
> > settled, we may need to reorder the patch based on the decision we
> > take. If we decide to proceed with the parser changes, my
> > understanding is that they should come first, followed by the
> > implementation of support for the ANY/FIRST clauses.
>
> I agree. I do not see any other correct way to do it.
>

I've reordered the patches as mentioned here to ensure each patch is
independently functional. The updated sequence is:

1) 0001-Refactor-syncrep-parsing-to-represent-bare-standby-l.patch :
Introduces a new synchronous replication method SYNC_REP_DEFAULT to
represent the bare list form parsed from standby_list. This lets
callers clearly distinguish between three forms:

- Explicit priority syntax — FIRST N (...) or N (...)
- Quorum syntax — ANY N (...)
- Simple list syntax — no FIRST or ANY keyword

2) 0002-Add-ANY-N-semantics-to-synchronized_standby_slots.patch :
Extends synchronized_standby_slots with ANY N quorum semantics.

3) 0003-Add-FIRST-N-and-N-.-priority-syntax-to-synchronized_.patch :
Adds support for FIRST N and N (...) priority syntax to
synchronized_standby_slots

>
> A few trivial comments on 001:
>
> 1)
> +# B) ANY 1 (sb1_slot, sb2_slot) (quorum mode)
> +#    - Proceeds when at least N slots have caught up
> +#    - Skips missing/invalid/logical slots and lagging slots
> (inactive or active)
> +#      to find N caught-up slots
>
> We can mention 'ANY N'  instead of 'ANY 1' so that the explanation
> using 'N' makes more sense.
>
> 2)
> +sub poll_query_until_quiet
> +{
> + my ($node, $dbname, $query, $expected, $timeout_secs) = @_;
> +
> + $expected = 't' unless defined($expected);
> + $timeout_secs = $PostgreSQL::Test::Utils::timeout_default
>
> We can get rid of this function now.

Above two comments have been taken care of in the attached patches.

Please take a look and let me know your views.

--
With Regards,
Ashutosh Sharma.

Attachment: 0001-Refactor-syncrep-parsing-to-represent-bare-standby-l.patch
Description: Binary data

Attachment: 0002-Add-ANY-N-semantics-to-synchronized_standby_slots.patch
Description: Binary data

Attachment: 0003-Add-FIRST-N-and-N-.-priority-syntax-to-synchronized_.patch
Description: Binary data

Reply via email to