Re: Concurrent ALTER SEQUENCE RESTART Regression

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Jason Petersen <jason(at)citusdata(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Concurrent ALTER SEQUENCE RESTART Regression
Date: 2017-05-03 07:39:00
Message-ID: CAB7nPqQyGarGv3WUe07fgSWmKOOGiFL_SJhQ2ibdPwFZAq+QVg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Wed, May 3, 2017 at 2:26 PM, Petr Jelinek
<petr(dot)jelinek(at)2ndquadrant(dot)com> wrote:
>>> It could be done if ALTER SEQUENCE held stronger lock on the sequence
>>> relation though, but it needs to block nextval as well in that case
>>> (which I think would mean nextval would need row share lock, unless we
>>> are okay with doing access exclusive lock during ALTER) as I mentioned
>>> up thread.
>>
>> That one is more complicated, because AccessShareLocks on sequences are
>> held on for performance reasons... Possibly not really required
>> anymore, due to fast-path locks? Still'd increase the number of
>> lock/unlock cycles.
>
> Right but won't we still have problem with nextval ignoring the ALTER
> until it commits without that?

Right, the only thing that you can really do here is to take a
stronger lock on the parent object, and that will be disruptive for
concurrent sessions. Not sure what Peter wants to do here, but
3d092fe5 is just putting sugar powder on top of a cake badly-cooked.
What we ought to do instead is review the recipy as users should never
be able to face "tuple concurrently updated". So as far as I can see,
this open item is not addressed. And the issues with locking around
XLOG/catalog updates are not solved either.
--
Michael

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Vitaliy Gomenyuk 2017-05-03 10:04:06 Re: BUG #14635: Query is executed slower on hot standby slave database then on master database
Previous Message Petr Jelinek 2017-05-03 05:26:21 Re: Concurrent ALTER SEQUENCE RESTART Regression

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2017-05-03 08:26:53 Re: scram and \password
Previous Message Pavel Stehule 2017-05-03 06:56:12 Re: proposal psql \gdesc