Re: Bug in logical decoding of in-progress transactions - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Bug in logical decoding of in-progress transactions
Date
Msg-id CAA4eK1KqHfHt1GxYpSMu5qkRR_9LnEdvtyLY0pCsZC8+GNVoVA@mail.gmail.com
Whole thread Raw
In response to Re: Bug in logical decoding of in-progress transactions  (Dilip Kumar <dilipbalaut@gmail.com>)
Responses Re: Bug in logical decoding of in-progress transactions  (Dilip Kumar <dilipbalaut@gmail.com>)
List pgsql-hackers
On Thu, Sep 10, 2020 at 12:00 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
>
> On Thu, Sep 10, 2020 at 11:53 AM Dilip Kumar <dilipbalaut@gmail.com> wrote:
>>
>>> >
>>> > I have written a test case to reproduce the same.
>

Can we write an isolation test for this scenario? See some similar
tests in contrib/test_decoding/specs. If that is possible then we can
probably remove the test which failed and instead write an isolation
test involving three transactions as shown by you. Also, please
prepare two separate patches (one for test and other for code) if you
are able to convert existing test to an isolation test as that will
make it easier to test the fix.

>
> I have removed some comments which are not valid after this patch.
>

Few comments:
=============
1. We need to set xact_wrote_changes in pg_decode_stream_truncate() as
well along with the APIs in which you have set it.
2.
+static void
+pg_output_stream_start(LogicalDecodingContext *ctx, TestDecodingData
*data, ReorderBufferTXN *txn, bool last_write)
+{
  OutputPluginPrepareWrite(ctx, true);
  if (data->include_xids)
  appendStringInfo(ctx->out, "opening a streamed block for transaction
TXN %u", txn->xid);
@@ -601,16 +610,15 @@ pg_decode_stream_start(LogicalDecodingContext *ctx,
  OutputPluginWrite(ctx, true);

In this API, we need to use 'last_write' in OutputPluginPrepareWrite()
and OutputPluginWrite().

The attached patch fixes both these comments.

-- 
With Regards,
Amit Kapila.

Attachment

pgsql-hackers by date:

Previous
From: "tsunakawa.takay@fujitsu.com"
Date:
Subject: RE: Implement UNLOGGED clause for COPY FROM
Next
From: Kasahara Tatsuhito
Date:
Subject: Re: autovac issue with large number of tables