Re: Concurrent ALTER SEQUENCE RESTART Regression

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: 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-04-28 07:55:45
Message-ID: CAB7nPqQ=yHXxiWU2FuaC13L_5y7UG7R_OkJhWQbXYMJPXCDtNg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Thu, Apr 27, 2017 at 4:10 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> On April 27, 2017 12:06:55 AM PDT, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
>>On Thu, Apr 27, 2017 at 3:23 PM, Andres Freund <andres(at)anarazel(dot)de>
>>wrote:
>>> More fun:
>>>
>>> A: CREATE SEQUENCE someseq;
>>> A: BEGIN;
>>> A: ALTER SEQUENCE someseq MAXVALUE 10;
>>> B: SELECT nextval('someseq') FROM generate_series(1, 1000);
>>>
>>> => ignores maxvalue
>>
>>Well, for this one that's because the catalog change is
>>transactional...
>
> Or because the locking model is borked.

The operation actually relies heavily on the fact that the exclusive
lock on the buffer of pg_sequence is hold until the end of the catalog
update. And using heap_inplace_update() seems mandatory to me as the
metadata update should be non-transactional, giving the attached. I
have added some isolation tests. Thoughts? The attached makes HEAD map
with the pre-9.6 behavior.
--
Michael

Attachment Content-Type Size
alter-seq-lock-v2.patch text/x-patch 3.0 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Pietro Pugni 2017-04-28 08:28:05 Re: BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.
Previous Message Michael Meskes 2017-04-27 17:35:02 Re: BUG #14633: ecpg : nothing is generated when using option -v

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-04-28 08:07:45 Re: .pgpass's behavior has changed
Previous Message Kyotaro HORIGUCHI 2017-04-28 07:54:32 .pgpass's behavior has changed