From: Tom Lane <tgl@sss.pgh.pa.us>
To: Luka Žitnik <luka.zitnik@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Unexpected serialization error
Date: Sat, 13 Feb 2021 12:21:58 -0500
Message-ID: <1661461.1613236918@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEXuP_U743JdQxnPXL7xWu9ODyY0Xz2wnO0O_nokQnb++foswg@mail.gmail.com>
References: <CAEXuP_U743JdQxnPXL7xWu9ODyY0Xz2wnO0O_nokQnb++foswg@mail.gmail.com>
=?UTF-8?B?THVrYSDFvWl0bmlr?= <luka.zitnik@gmail.com> writes:
> I had no luck over at general slack channel. So I'm beginning to treat this
> as a bug. Here's a test case that unexpectedly fails at last insert. I
> expect it not to fail because the rows that the two transactions act on are
> unrelated to one another.
The bug is that you're assuming exact tracking of the SSI serialization
rules. It's not done that way, because it'd be prohibitively expensive.
(I've not dug into this example in any detail, but I suspect it's
acquiring page-level not tuple-level predicate locks, thus the
transactions conflict because each tries to update a page the other one
already read.)
The short answer is that ANY application that's depending on serializable
mode MUST be prepared to retry serialization failures. You don't get to
skip that just because there theoretically shouldn't be a failure.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, luka.zitnik@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: Unexpected serialization error
In-Reply-To: <1661461.1613236918@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox