Re: ERROR: tuple concurrently updated when modifying privileges

From: Chris Travers <chris(dot)travers(at)adjust(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: nickb <nickb(at)imap(dot)cc>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ERROR: tuple concurrently updated when modifying privileges
Date: 2019-05-14 09:39:12
Message-ID: CAN-RpxBU9SOY08KECMavNy-O-t7J7h1dnExDdC1GPbwUtSx=CA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 14, 2019 at 9:11 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Tue, May 14, 2019 at 08:08:05AM +0200, Chris Travers wrote:
> > Having thought about this a bit, I think the best solution would be to
> have
> > grant take out an access share lock to the tables granted. This would
> > prevent concurrent alter table operations from altering the schema
> > underneath the grant as well, and thus possibly cause other race
> conditions.
> >
> > Any thoughts?
>
> "tuple concurrently updated" is an error message which should never be
> user-facing, and unfortunately there are many scenarios where it can
> be triggered by playing with concurrent DDLs:
> https://postgr.es/m/20171228063004.GB6181@paquier.xyz
>
> If you have an idea of patch, could you write it? Having an isolation
> test case would be nice as well.
>

I will give Nick a chance to do the patch if he wants it (I have reached
out). Otherwise sure.

I did notice one more particularly exotic corner case that is not resolved
by this proposed fix.

If you have two transactions with try to grant onto the same pg entity
(table etc) *both* will typically fail on the same error.

I am not sure that is a bad thing because I am not sure how concurrent
grants are supposed to work with MVCC but I think that would require a
fundamentally different approach.

> --
> Michael
>

--
Best Regards,
Chris Travers
Head of Database

Tel: +49 162 9037 210 | Skype: einhverfr | www.adjust.com
Saarbrücker Straße 37a, 10405 Berlin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message nickb 2019-05-14 09:53:23 Re: PG 12 draft release notes
Previous Message Amit Langote 2019-05-14 09:25:43 Re: PostgreSQL 12: Feature Highlights