Re: Concurrent ALTER SEQUENCE RESTART Regression
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Michael Paquier <michael.paquier@gmail.com>,
Jason Petersen <jason@citusdata.com>, PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Date: 2017-05-02T16:45:35Z
Lists: pgsql-bugs, pgsql-hackers
On Thu, Apr 27, 2017 at 1:52 AM, Andres Freund <andres@anarazel.de> wrote:= > In contrast to <v10, the actual change of the tuple is *not* happening > with the page lock held. But now we do log XLOG_SEQ_LOG, then unlock > the buffer, and then do a CatalogTupleUpdate(). How is that correct? > And if so, why isn't there a honking large comment explaining why it is? I can't actually understand this complaint. I think this code is buggy, but for different reasons than you do. The page lock is held, because read_seq_tuple() acquires it. And then we call heap_open() with the buffer lock held?! I don't think that's a good idea in any way - we shouldn't be doing complex operations that might acquire a buffer lock while we're holding a buffer lock. But by the same token surely we don't want to do CatalogUpdateIndexes() while holding the buffer lock either; mutual exclusion needs to be managed at some higher level, using, say, a heavyweight tuple lock. Another thing that doesn't look so good about AlterSequence is that it uses RangeVarGetRelid() instead of RangeVarGetsRelidExtended() with RangeVarCallbackOwnsRelation or some derivative thereof. That of course means you can obstruct access to a sequence you don't own. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Make ALTER SEQUENCE, including RESTART, fully transactional.
- 3d79013b970d 10.0 landed
-
Modify sequence catalog tuple before invoking post alter hook.
- 665104557fdc 10.0 landed
-
Use weaker locks when updating pg_subscription_rel
- 521fd4795e3e 10.0 cited
-
Add pg_sequence system catalog
- 1753b1b02703 10.0 cited
-
Modify sequence state storage to eliminate dangling-pointer problem
- a2597ef17958 7.3.1 cited