Re: Concurrent ALTER SEQUENCE RESTART Regression

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(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-26 17:48:13
Message-ID: 20170426174813.slaq6mka7v6xohap@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 2017-04-26 12:15:53 -0400, Peter Eisentraut wrote:
> On 4/25/17 21:24, Michael Paquier wrote:
> > Yes, and that's fine, taking a stronger lock on pg_sequence would be
> > disruptive for other sessions, including the ones updating pg_sequence
> > for different sequences. The point I am trying to make here is that
> > the code path updating pg_sequence should make sure that the
> > underlying object is properly locked first, so as the update is
> > concurrent-safe because this uses simple_heap_update that assumes that
> > the operation will be concurrent-safe. For example, take tablecmds.c,
> > we make sure that any relation ALTER TABLE works on gets a proper lock
> > with relation_open first, in what sequences would be different now
> > that they have their own catalog?
>
> Pretty much everything other than tables is a counterexample.
>
> git grep RowExclusiveLock src/backend/commands/*.c
>
> Only tables have an underlying object to lock. Most other DDL commands
> don't have anything else to lock and run DDL under RowExclusiveLock.

What's your proposed fix?

- Andres

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message pietro.pugni 2017-04-26 18:23:22 BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.
Previous Message Tom Lane 2017-04-26 16:30:02 Re: Re: AfterTriggerSaveEvent() Error on altered foreign key cascaded delete

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-04-26 18:01:57 Re: tablesync patch broke the assumption that logical rep depends on?
Previous Message Joshua D. Drake 2017-04-26 17:37:48 Re: RFC: ALTER SYSTEM [...] COMMENT