Re: BUG #14150: Attempted to delete invisible tuple

From: Oskari Saarenmaa <os(at)aiven(dot)io>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Peter Tripp <peter(at)chartio(dot)com>, Virendra Negi <virendra(at)idyllic-software(dot)com>, pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14150: Attempted to delete invisible tuple
Date: 2016-07-06 06:05:59
Message-ID: 88248a24-47d1-d575-a63f-2b56a09f82e2@aiven.io
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

29.06.2016, 08:13, Michael Paquier kirjoitti:
> On Wed, Jun 29, 2016 at 8:40 AM, Peter Geoghegan <pg(at)heroku(dot)com> wrote:
>> On Mon, Jun 27, 2016 at 8:28 PM, Michael Paquier
>> <michael(dot)paquier(at)gmail(dot)com> wrote:
>>> Could you post it? I'd be interested in seeing that.
>>
>> Attached is a reasonably minimal testcase, showing many "attempted to
>> delete invisible tuple" errors for me quickly and reliably. The
>> shellscript expects to be able to invoke pgbench without any custom
>> arguments, and runs the attach custom pgbench script in an infinite
>> loop. On my laptop, there is a roughly 90% chance that the script's 5
>> second pgbench runs will raise the error at least once.
>
> Thanks! I can see the problem with that. Now let's dig into it...

I ran into this yesterday on 9.5.3 and created a test case before
noticing this thread. My test case just inserts a single
toast-requiring row using ON CONFLICT DO NOTHING and typically fails
immediately:

pgbench -f random.sql -n -T 2 -c 2

random.sql:

-- CREATE TABLE vtest (id INT UNIQUE, blob BYTEA);
TRUNCATE vtest;
INSERT INTO vtest (id, blob) VALUES (1, encrypt(repeat('a',
8192)::bytea, 'x'::bytea, 'aes')) ON CONFLICT DO NOTHING;

ISTM this is caused by toast knowing nothing about speculative
insertion: when two backends have executed a speculative heap_insert
with a conflicting key and the latter one tries to abort after receiving
specConflict there's nothing in tqual.c to say that the toast rows
associated with speculative insertion should be visible to that operation.

/ Oskari

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2016-07-06 06:24:13 Re: BUG #14150: Attempted to delete invisible tuple
Previous Message nahumcastro 2016-07-06 05:27:27 BUG #14229: pg_config missing from postgresql95-devel