On Thursday, July 1, 2021 11:48 AM Ajin Cherian <itsa...@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