From: Michael Paquier <michael@paquier.xyz>
To: Andres Freund <andres@anarazel.de>
Cc: Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
Cc: pgsql-hackers@lists.postgresql.org, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: out-of-order XID insertion in KnownAssignedXids
Date: Tue, 9 Oct 2018 16:52:58 +0900
Message-ID: <20181009075258.GI2137@paquier.xyz> (raw)
In-Reply-To: <20181009055900.GH2137@paquier.xyz>
References: <0c96b653-4696-d4b4-6b5d-78143175d113@postgrespro.ru>
<20181005080422.GA7863@paquier.xyz>
<581a80f7-3992-f319-302d-7c9a384d64f7@postgrespro.ru>
<2A819787-9E67-41EF-B89A-A906996924E5@anarazel.de>
<fc51532c-dbf5-dce0-b31c-82c7a0b837ed@postgrespro.ru>
<20181008163049.nvaui5kjrsav2ojn@alap3.anarazel.de>
<20181009055900.GH2137@paquier.xyz>
On Tue, Oct 09, 2018 at 02:59:00PM +0900, Michael Paquier wrote:
> +1. I am looking at how to make that possible.
And so... Going through a bit of investigation the problem is that each
2PC transaction preparing finishes by putting the procarray in a state
where there are two entries referring to the same transaction running as
MarkAsPrepared adds an extra entry on the top of the one already
existing. This is expected though per the comments in
ProcArrayClearTransaction(), as it assumes that MyProc can be safely
cleaned and it assumes that there is a duplicated entry. Then,
GetRunningTransactionData() ignores the assumption that those duplicate
entries can exist, which makes the snapshot data taken as incorrect,
generating those incorrect XLOG_RUNNING_XACT records.
The most simple fix I can think of first is to tweak the origin of the
problem in GetRunningTransactionData() so as those duplicate XIDs are
ignored if found as there has to be a state between the time
MarkAsPrepared() inserted the 2PC entry in the procarray and the time
ProcArrayClearTransaction() gets called.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
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-hackers@postgresql.org
Cc: michael@paquier.xyz, andres@anarazel.de, k.knizhnik@postgrespro.ru
Subject: Re: out-of-order XID insertion in KnownAssignedXids
In-Reply-To: <20181009075258.GI2137@paquier.xyz>
* 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