Re: Speedup twophase transactions

From: Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: David Steele <david(at)pgmasters(dot)net>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Speedup twophase transactions
Date: 2016-04-06 09:47:18
Message-ID: 6FCB694C-4DC3-40A4-B31C-A0E1B6E5F176@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Apr 2, 2016, at 3:14 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
>
> On Fri, Apr 1, 2016 at 10:53 PM, Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru> wrote:
>> I wrote:
>>> While testing the patch, I found a bug in the recovery conflict code
>>> path. You can do the following to reproduce it:
>>> 1) Start a master with a standby
>>> 2) prepare a transaction on master
>>> 3) Stop immediate on standby to force replay
>>> 4) commit prepare transaction on master
>>> 5) When starting the standby, it remains stuck here:
>>
>> Hm, I wasn’t able to reproduce that. Do you mean following scenario or am I missing something?
>>
>> (async replication)
>>
>> $node_master->psql('postgres', "
>> begin;
>> insert into t values (1);
>> prepare transaction 'x';
>> ");
>> $node_slave->teardown_node;
>> $node_master->psql('postgres',"commit prepared 'x'");
>> $node_slave->start;
>> $node_slave->psql('postgres',"select count(*) from pg_prepared_xacts", stdout => \$psql_out);
>> is($psql_out, '0', "Commit prepared on master while slave is down.");
>
> Actually, not exactly, the transaction prepared on master created a
> table. Sorry for the lack of precisions in my review.

Sorry for delay.

Actually I can’t reproduce that again, tried with following tx:

begin;
insert into t values(0);
create table t1(id int);
insert into t1 values(1);
create table t2(id int);
insert into t2 values(2);
savepoint s1;
drop table t1;
select * from t for update;
select * from t2 for share;
prepare transaction 'x’;

Attachment Content-Type Size
twophase_recovery_bug.pl text/x-perl-script 1.3 KB
unknown_filename text/plain 96 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-04-06 09:52:28 Re: Move PinBuffer and UnpinBuffer to atomics
Previous Message Simon Riggs 2016-04-06 09:43:23 Re: WIP: Failover Slots