On Wed, Feb 3, 2021 at 1:28 PM Ajin Cherian <itsa...@gmail.com> wrote: > > On Tue, Feb 2, 2021 at 9:03 PM Ajin Cherian <itsa...@gmail.com> wrote: > > > I am sorry, my above steps were not correct. I think the reason for > > the failure I was seeing were some other steps I did prior to this. I > > will recreate this and update you with the appropriate steps. > > The correct steps are as follows: > > Publisher: > > postgres=# CREATE TABLE tab_rep (a int primary key); > CREATE TABLE > postgres=# INSERT INTO tab_rep SELECT generate_series(1,1000000); > INSERT 0 1000000 > postgres=# CREATE PUBLICATION tap_pub FOR ALL TABLES; > CREATE PUBLICATION > > Subscriber: > postgres=# CREATE TABLE tab_rep (a int primary key); > CREATE TABLE > postgres=# CREATE SUBSCRIPTION tap_sub CONNECTION 'host=localhost > dbname=postgres port=6972' PUBLICATION tap_pub WITH (enabled = false); > NOTICE: created replication slot "tap_sub" on publisher > CREATE SUBSCRIPTION > postgres=# ALTER SUBSCRIPTION tap_sub enable; > ALTER SUBSCRIPTION > > Allow the tablesync to complete and then drop the subscription, the > table remains full and restarting the subscription should fail with a > constraint violation during tablesync but it does not. > > > Subscriber: > postgres=# drop subscription tap_sub ; > NOTICE: dropped replication slot "tap_sub" on publisher > DROP SUBSCRIPTION > postgres=# CREATE SUBSCRIPTION tap_sub CONNECTION 'host=localhost > dbname=postgres port=6972' PUBLICATION tap_pub WITH (enabled = false); > NOTICE: created replication slot "tap_sub" on publisher > CREATE SUBSCRIPTION > postgres=# ALTER SUBSCRIPTION tap_sub enable; > ALTER SUBSCRIPTION > > This takes the subscriber into an error loop but no mention of what > the error was: >
Thanks for the report. The problem here was that the error occurred when we were trying to copy the large data. Now, before fetching the entire data we issued a rollback that led to this problem. I think the alternative here could be to first fetch the entire data when the error occurred then issue the following commands. Instead, I have modified the patch to perform 'drop_replication_slot' in the beginning if the relstate is datasync. Do let me know if you can think of a better way to fix this? -- With Regards, Amit Kapila.
v26-0001-Tablesync-Solution1.patch
Description: Binary data