Re: On login trigger: take three

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Mikhail Gribkov <youzhick(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Nancarrow <gregn4422(at)gmail(dot)com>, Ivan Panchenko <wao(at)mail(dot)ru>, Teodor Sigaev <teodor(at)sigaev(dot)ru>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Subject: Re: On login trigger: take three
Date: 2023-10-12 22:54:01
Message-ID: CAPpHfduP=Tw7PQsoxs3nrvfVmB8JCXfU7ZCR82yJc3Y5FPXkKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 12, 2023 at 8:35 PM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Tue, Oct 10, 2023 at 3:43 PM Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
> > Yep, in v43 it worked that way. One transaction has to wait for
> > another finishing update of pg_database tuple, then fails. This is
> > obviously ridiculous. Since overlapping setters of flag will have to
> > wait anyway, I changed lock mode in v44 for them to
> > AccessExclusiveLock. Now, waiting transaction then sees the updated
> > tuple and doesn't fail.
>
> Doesn't that mean that if you create the first login trigger in a
> database and leave the transaction open, nobody can connect to that
> database until the transaction ends?

It doesn't mean that, because when trying to reset the flag v44 does
conditional lock. So, if another transaction is holding the log we
will just skip resetting the flag. So, the flag will be cleared on
the first connection after that transaction ends.

------
Regards,
Alexander Korotkov

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-10-12 23:09:21 Re: Wait events for delayed checkpoints
Previous Message Tomas Vondra 2023-10-12 22:38:40 BRIN minmax multi - incorrect distance for infinite timestamp/date