Re: Single transaction in the tablesync worker?
Ajin Cherian <itsajin@gmail.com>
From: Ajin Cherian <itsajin@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Peter Smith <smithpb2250@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-02-03T07:58:00Z
Lists: pgsql-hackers
On Tue, Feb 2, 2021 at 9:03 PM Ajin Cherian <itsajin@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: 2021-02-02 05:01:34.698 EST [1549] LOG: logical replication table synchronization worker for subscription "tap_sub", table "tab_rep" has started 2021-02-02 05:01:34.739 EST [1549] ERROR: table copy could not rollback transaction on publisher 2021-02-02 05:01:34.739 EST [1549] DETAIL: The error was: another command is already in progress 2021-02-02 05:01:34.740 EST [8028] LOG: background worker "logical replication worker" (PID 1549) exited with exit code 1 2021-02-02 05:01:40.107 EST [1711] LOG: logical replication table synchronization worker for subscription "tap_sub", table "tab_rep" has started 2021-02-02 05:01:40.121 EST [1711] ERROR: could not create replication slot "pg_16479_sync_16435": ERROR: replication slot "pg_16479_sync_16435" already exists 2021-02-02 05:01:40.121 EST [8028] LOG: background worker "logical replication worker" (PID 1711) exited with exit code 1 2021-02-02 05:01:45.140 EST [1891] LOG: logical replication table synchronization worker for subscription "tap_sub", table "tab_rep" has started regards, Ajin Cherian Fujitsu Australia
Commits
-
Fix relcache reference leak introduced by ce0fdbfe97.
- 8a4f9522d0c7 14.0 landed
-
Fix Subscription test added by commit ce0fdbfe97.
- c8b21b037814 14.0 landed
-
Allow multiple xacts during table sync in logical replication.
- ce0fdbfe9722 14.0 landed
-
Logical replication support for initial data copy
- 7c4f52409a8c 10.0 cited