pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
To: Michael Paquier <michael@paquier.xyz>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: out-of-order XID insertion in KnownAssignedXids
Date: Mon, 8 Oct 2018 12:33:20 +0300
Message-ID: <6ac20e7b-08a7-eb00-08f7-d332ec1f5605@postgrespro.ru> (raw)
In-Reply-To: <20181008091451.GD2754@paquier.xyz>
References: <0c96b653-4696-d4b4-6b5d-78143175d113@postgrespro.ru>
	<20181005080422.GA7863@paquier.xyz>
	<581a80f7-3992-f319-302d-7c9a384d64f7@postgrespro.ru>
	<20181008091451.GD2754@paquier.xyz>



On 08.10.2018 12:14, Michael Paquier wrote:
> On Mon, Oct 08, 2018 at 12:04:28PM +0300, Konstantin Knizhnik wrote:
>> The simplest way to fix the problem is to ignore duplicates before adding
>> them to KnownAssignedXids.
>> We in any case perform sort i this place...
> I may of course be missing something, but shouldn't we not have
> duplicates in the first place?
The reason of appearing duplicated XIDs in case of 2PC seems to be clear.
It may be possible to eliminate it by clearing XID of MyPgxact for 
prepared transaction.
But there are two problems with it:
1. I am not sure that it will not break something
2. There is obvious race condition between adding GXACT to ProcArrayAdd 
and invalidating XID of current transaction.
If it is cleared before calling ProcArrayAdd, then there will be some 
moment when XID is not present in procarray.
If it is done after calling ProcArrayAdd, then still it is possible to 
see duplicated XID in procarray.

 From my point of view it is easier and less invasive to exclude 
duplicates while replaying RUNNING_XIDS record.




-- 
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company





view thread (16+ messages)  latest in thread

Message-ID: <6ac20e7b-08a7-eb00-08f7-d332ec1f5605@postgrespro.ru>
Permalink:  ../6ac20e7b-08a7-eb00-08f7-d332ec1f5605@postgrespro.ru/
Also on:    postgresql.org/message-id/6ac20e7b-08a7-eb00-08f7-d332ec1f5605@postgrespro.ru

 · 

reply

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: k.knizhnik@postgrespro.ru, michael@paquier.xyz
  Subject: Re: out-of-order XID insertion in KnownAssignedXids
  In-Reply-To: <6ac20e7b-08a7-eb00-08f7-d332ec1f5605@postgrespro.ru>

* 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