RE: [HACKERS] logical decoding of two-phase transactions - Mailing list pgsql-hackers

From tanghy.fnst@fujitsu.com
Subject RE: [HACKERS] logical decoding of two-phase transactions
Date
Msg-id OS0PR01MB6113239BE2404681AAB9E2F3FB1F9@OS0PR01MB6113.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Re: [HACKERS] logical decoding of two-phase transactions  (Ajin Cherian <itsajin@gmail.com>)
Responses Re: [HACKERS] logical decoding of two-phase transactions
Re: [HACKERS] logical decoding of two-phase transactions
List pgsql-hackers
On Thursday, July 1, 2021 11:48 AM Ajin Cherian <itsajin@gmail.com>
> 
> Adding a new patch (0004) to this patch-set that handles skipping of
> empty streamed transactions. patch-0003 did not
> handle empty streamed transactions. To support this, added a new flag
> "sent_stream_start" to PGOutputTxnData.
> Also transactions which do not have any data will not be stream
> committed or stream prepared or stream aborted.
> Do review and let me know if you have any comments.
> 

Thanks for your patch. I met an issue while using it. When a transaction contains TRUNCATE, the subscriber reported an
error:" ERROR:  no data left in message" and the data couldn't be replicated. 
 

Steps to reproduce the issue:

(set logical_decoding_work_mem to 64kB at publisher so that streaming could work. )

------publisher------
create table test (a int primary key, b varchar);
create publication pub for table test;

------subscriber------
create table test (a int primary key, b varchar);
create subscription sub connection 'dbname=postgres' publication pub with(two_phase=on, streaming=on);

------publisher------
BEGIN;
TRUNCATE test;
INSERT INTO test SELECT i, md5(i::text) FROM generate_series(1001, 6000) s(i);
UPDATE test SET b = md5(b) WHERE mod(a,2) = 0;
DELETE FROM test WHERE mod(a,3) = 0;
COMMIT;

The above case worked ok when remove 0004 patch, so I think it’s a problem of 0004 patch. Please have a look.

Regards
Tang

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Signed vs. Unsigned (some)
Next
From: David Rowley
Date:
Subject: Re: Small clean up in nodeAgg.c