Bug in two-phase transaction recovery - Mailing list pgsql-hackers

From Stas Kelvich
Subject Bug in two-phase transaction recovery
Date
Msg-id 39DA46C9-9212-4CAF-AD4D-1C6FA91E1CA0@postgrespro.ru
Whole thread Raw
Responses Re: Bug in two-phase transaction recovery  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
Hello.

Some time ago two-phase state file format was changed to have variable size GID,
but several places that read that files were not updated to use new offsets. Problem
exists in master and 9.6 and can be reproduced on prepared transactions with
savepoints. For example:

create table t(id int);
begin;
insert into t values (42);
savepoint s1;
insert into t values (43);
prepare transaction 'x';
begin;
insert into t values (142);
savepoint s1;
insert into t values (143);
prepare transaction 'y’;

and restart the server. Startup process will hang. Fix attached.

Also while looking at StandbyRecoverPreparedTransactions() i’ve noticed that buffer
for 2pc file is allocated in TopMemoryContext but never freed. That probably exists
for a long time.





--
Stas Kelvich
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company


Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Install extensions using update scripts (was Re: Remove superuser() checks from pgstattuple)
Next
From: Victor Wagner
Date:
Subject: Re: Patch: Implement failover on libpq connect level.