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


Reply via email to