On Mon, Mar 8, 2021 at 11:30 AM Ajin Cherian <itsa...@gmail.com> wrote: > > On Fri, Mar 5, 2021 at 9:25 PM vignesh C <vignes...@gmail.com> wrote: > > > Created new patch v53:
Thanks for the updated patch. I had noticed one issue, publisher does not get stopped normally in the following case: # Publisher steps psql -d postgres -c "CREATE TABLE do_write(id serial primary key);" psql -d postgres -c "INSERT INTO do_write VALUES(generate_series(1,10));" psql -d postgres -c "CREATE PUBLICATION mypub FOR TABLE do_write;" # Subscriber steps psql -d postgres -p 9999 -c "CREATE TABLE do_write(id serial primary key);" psql -d postgres -p 9999 -c "INSERT INTO do_write VALUES(1);" # to cause a PK violation psql -d postgres -p 9999 -c "CREATE SUBSCRIPTION mysub CONNECTION 'host=localhost port=5432 dbname=postgres' PUBLICATION mypub WITH (two_phase = true);" # prepare & commit prepared at publisher psql -d postgres -c \ "begin; insert into do_write values (100); prepare transaction 'test1';" psql -d postgres -c "commit prepared 'test1';" Stop publisher: ./pg_ctl -D publisher stop waiting for server to shut down............................................................... failed pg_ctl: server does not shut down This is because the following process does not exit: postgres: walsender vignesh 127.0.0.1(41550) START_REPLICATION It continuously loops at the below: #0 0x00007f1c520d3bca in __libc_pread64 (fd=6, buf=0x555b1b3f7870, count=8192, offset=0) at ../sysdeps/unix/sysv/linux/pread64.c:29 #1 0x0000555b1a8f6d20 in WALRead (state=0x555b1b3f1ce0, buf=0x555b1b3f7870 "\n\321\002", startptr=16777216, count=8192, tli=1, errinfo=0x7ffe693b78c0) at xlogreader.c:1116 #2 0x0000555b1ac8ce10 in logical_read_xlog_page (state=0x555b1b3f1ce0, targetPagePtr=16777216, reqLen=8192, targetRecPtr=23049936, cur_page=0x555b1b3f7870 "\n\321\002") at walsender.c:837 #3 0x0000555b1a8f6040 in ReadPageInternal (state=0x555b1b3f1ce0, pageptr=23044096, reqLen=5864) at xlogreader.c:608 #4 0x0000555b1a8f5849 in XLogReadRecord (state=0x555b1b3f1ce0, errormsg=0x7ffe693b79c0) at xlogreader.c:329 #5 0x0000555b1ac8ff4a in XLogSendLogical () at walsender.c:2846 #6 0x0000555b1ac8f1e5 in WalSndLoop (send_data=0x555b1ac8ff0e <XLogSendLogical>) at walsender.c:2289 #7 0x0000555b1ac8db2a in StartLogicalReplication (cmd=0x555b1b3b78b8) at walsender.c:1206 #8 0x0000555b1ac8e4dd in exec_replication_command ( cmd_string=0x555b1b331670 "START_REPLICATION SLOT \"mysub\" LOGICAL 0/0 (proto_version '2', two_phase 'on', publication_names '\"mypub\"')") at walsender.c:1646 #9 0x0000555b1ad04460 in PostgresMain (argc=1, argv=0x7ffe693b7cc0, dbname=0x555b1b35cc58 "postgres", username=0x555b1b35cc38 "vignesh") at postgres.c:4323 I felt the publisher should get stopped in this case. Thoughts? Regards, Vignesh