Getting rid of "tuple concurrently updated" elog()s with concurrentDDLs (at least ALTER TABLE) - Mailing list pgsql-hackers

From Michael Paquier
Subject Getting rid of "tuple concurrently updated" elog()s with concurrentDDLs (at least ALTER TABLE)
Date
Msg-id 20171226045503.GA17182@paquier.xyz
Whole thread Raw
Responses Re: Getting rid of "tuple concurrently updated" elog()s with concurrent DDLs (at least ALTER TABLE)
List pgsql-hackers
Hi all,

Triggering "tuple concurrently updated" from heapam.c, which is an elog(),
is not that difficult for some DDL commands. For example with ALTER ROLE,
just create a role:
psql --no-psqlrc -c 'create role popo'

And then run that in two sessions and the error will show up, triggered
from CatalogTupleUpdate():
while true; do psql --no-psqlrc -c "alter role popo password 'foo'"; done

In this case, upgrading the lock taken on pg_authid from RowExclusiveLock
to ShareRowExclusiveLock prevents concurrent sessions to update each other,
which is what the patch attached does.

I think that we should get rid of all those errors, for many applications
doing concurrent DDLs getting this error is surprising, and could be thought
as a corrupted instance. I am just touching the tip of the iceberg here, as
I have the gut feeling that there are other objects where it is possible to
trigger the failure, and an analysis effort is going to be costly. So I'd
like to get first the temperature about such analysis.

So, opinions?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: AS OF queries
Next
From: Jeff Janes
Date:
Subject: Deadlock in multiple CIC.