Re: An attempt to avoid locally-committed-but-not-replicated-to-standby-transactions in synchronous replication

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>
Subject: Re: An attempt to avoid locally-committed-but-not-replicated-to-standby-transactions in synchronous replication
Date: 2022-05-10 07:59:59
Message-ID: CALj2ACVuj=Fo55NdWJy=fwweC-+pi7eQPRN3Kij3PQQcWFtYxQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 10, 2022 at 1:18 PM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>
> On Mon, May 9, 2022 at 4:39 PM Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>
> > > On 9 May 2022, at 14:44, Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> > >
> > > IMHO, making it wait for some amount of time, based on GUC is not a
> > > complete solution. It is just a hack to avoid the problem in some
> > > cases.
> >
> > Disallowing cancelation of locally committed transactions is not a hack. It's removing of a hack that was erroneously installed to make backend responsible to Ctrl+C (or client side statement timeout).
>
> I might be missing something but based on my understanding the
> approach is not disallowing the query cancellation but it is just
> adding the configuration for how much to delay before canceling the
> query. That's the reason I mentioned that this is not a guarenteed
> solution. I mean with this configuration value also you can not avoid
> problems in all the cases, right?

Yes Dilip, the proposed GUC in v1 patch doesn't allow waiting forever
for sync repl ack, in other words, doesn't allow blocking the pending
query cancels or proc die interrupts forever. The backends may linger
in case repl ack isn't received or sync replicas aren't reachable?
Users may have to set the GUC to a 'reasonable value'.

If okay, I can make the GUC behave this way - value 0 existing
behaviour i.e. no wait for sync repl ack, just process query cancels
and proc die interrupts immediately; value -1 wait unboundedly for the
ack; value > 0 wait for specified milliseconds for the ack.

Regards,
Bharath Rupireddy.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2022-05-10 08:02:58 Re: Privileges on PUBLICATION
Previous Message Dilip Kumar 2022-05-10 07:48:20 Re: An attempt to avoid locally-committed-but-not-replicated-to-standby-transactions in synchronous replication