Re: ERROR: tuple concurrently updated when modifying privileges

From: Chris Travers <chris(dot)travers(at)adjust(dot)com>
To: nickb <nickb(at)imap(dot)cc>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: ERROR: tuple concurrently updated when modifying privileges
Date: 2019-05-14 06:08:05
Message-ID: CAN-RpxAgXWxttz9HCr1jAtnPXLnW7ezeLZ6G8+aCMu8gy+EDjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 30, 2019 at 11:26 AM nickb <nickb(at)imap(dot)cc> wrote:

> Hello, hackers
>
> we witnessed this slightly misleading error in production and it took us a
> while to figure out what was taking place.
> Below are reproduction steps:
>
>
> -- setup
> create table trun(cate int4);
>
> -- session 1
> begin;
> truncate table trun;
>
> -- session 2
> grant insert on table trun to postgres;
>
> -- session 1
> end;
>
> -- session 2:
> ERROR: XX000: tuple concurrently updated
> LOCATION: simple_heap_update, heapam.c:4474
>
> Apparently the tuple in question is the pg_class entry of the table being
> truncated. I didn't look too deep into the cause, but I'm certain the error
> message could be improved at least.
>

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?

>
> Regards,
> Nick.
>
>
>

--
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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2019-05-14 06:18:07 Re: Tab completion for CREATE TYPE
Previous Message Thomas Munro 2019-05-14 05:50:58 Tab completion for CREATE TYPE