Re: Track replica origin progress for Rollback Prepared

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Ajin Cherian <itsajin(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Nikhil Sontakke <nikhils(at)2ndquadrant(dot)com>
Subject: Re: Track replica origin progress for Rollback Prepared
Date: 2021-03-05 03:11:40
Message-ID: CAA4eK1LPinQWEBEcQcv-rT7e8DVdO8-4A=rRpBv=1Qu1NTxW0A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 5, 2021 at 7:11 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Thu, Mar 4, 2021 at 8:03 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
>
> I have just checked via code coverage that we don't seem to have tests
> for recovery of replication origin advance for commit [1], see
> function xact_redo_commit. Similarly, a similar code is not covered
> for prepare [2], see EndPrepare. I think overall the test cases for
> replication origins are not very many. Now, I think if we want to have
> more tests in this area then we need to look at it more broadly. I
> think it could be that currently only subscriber-side covers some part
> of origins testing, otherwise, we don't have a detailed test suite by
> using replication origin APIs and second is probably it might be
> tricky to write a reliable recovery test case. One idea could be to
> just write a test for the non-recovery code path (the code added in
> function RecordTransactionAbortPrepared) and leave recovery testing
> for now.
>

For non-recovery, I have to write a test like below:

SELECT pg_replication_origin_create('regress');
SELECT pg_replication_origin_session_setup('regress');
Begin;
SELECT pg_replication_origin_xact_setup('0/aabbccdd', '2013-01-01 00:00');
Insert into t1 values(1);
Prepare Transaction 'foo';
SELECT pg_replication_origin_xact_setup('0/aabbccee', '2013-01-01 00:00');
Rollback Prepared 'foo';
SELECT pg_replication_origin_session_progress(true);

The thing which bothers me about such a test would be to call
pg_replication_origin_xact_setup after 'Prepare Transaction', it seems
like I am exploiting this API for this test. This API is not meant for
this purpose, so not sure if I should go ahead with this test or not.
What do you think? If you can think of any other alternative then let
me know? We don't have a very good infrastructure to test origins and
its progress except for the subscriber-side code.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2021-03-05 03:13:17 Re: [PATCH] remove deprecated v8.2 containment operators
Previous Message Kyotaro Horiguchi 2021-03-05 03:01:22 Re: Corruption during WAL replay