Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKfyz-0001VV-9V for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Jul 2016 06:06:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bKfyy-00017B-0s for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Jul 2016 06:06:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bKfyK-00086p-OY for pgsql-bugs@postgresql.org; Wed, 06 Jul 2016 06:06:08 +0000 Received: from ohmu.fi ([2001:1bc8:100:6::f301]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bKfyH-0004Yr-FF for pgsql-bugs@postgresql.org; Wed, 06 Jul 2016 06:06:07 +0000 Received: from [127.0.0.1] (localhost [IPv6:::1]) by ohmu.fi (Postfix) with ESMTP id 42E6F60504; Wed, 6 Jul 2016 09:06:00 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aiven.io; s=ohmu20151013; t=1467785160; bh=36UhjESbgX3kOtt/jKbBaUNOrUNzkgdhpwEUDlEHjhY=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From; b=Tfdzfgzdj4yEwD9iEPZmvIjoU/6zlVFGOuA7QOMpIFWIUE9K/clohRayox1UGL91o RGcTpvrtxZ2aqemZhqtVw7ppIhIuIAsbZLwI4YkA9H3ODUBcQ9x12dKfNy0xNVGEzA hUWP2q8QJz/5C3SCTFb/GEWkusA2rLfTrY85+j1w= Subject: Re: BUG #14150: Attempted to delete invisible tuple To: Michael Paquier , Peter Geoghegan References: <20160519123338.12513.20271@wrigleys.postgresql.org> Cc: Peter Tripp , Virendra Negi , pgsql-bugs From: Oskari Saarenmaa Message-ID: <88248a24-47d1-d575-a63f-2b56a09f82e2@aiven.io> Date: Wed, 6 Jul 2016 09:05:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 29.06.2016, 08:13, Michael Paquier kirjoitti: > On Wed, Jun 29, 2016 at 8:40 AM, Peter Geoghegan wrote: >> On Mon, Jun 27, 2016 at 8:28 PM, Michael Paquier >> 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 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs