Re: Logical replication - schema change not invalidating the relation cache
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: vignesh C <vignesh21@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>,
Dilip Kumar <dilipbalaut@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-01-05T23:02:31Z
Lists: pgsql-hackers
Attachments
- v5-0001-Fix-for-invalidating-logical-replication-relation.patch (text/x-diff) patch v5-0001
vignesh C <vignesh21@gmail.com> writes: > On Thu, 5 Jan 2023 at 03:17, Tom Lane <tgl@sss.pgh.pa.us> wrote: >> The bigger picture here though is that in examples such as the one >> you gave at the top of the thread, it's not very clear to me that >> there's *any* principled behavior. If the connection between publisher >> and subscriber tables is only the relation name, fine ... but exactly >> which relation name applies? > The connection between publisher and subscriber table is based on > relation id, During the first change relid, relname and schema name > from publisher will be sent to the subscriber. Subscriber stores these > id, relname and schema name in the LogicalRepRelMap hash for which > relation id is the key. Subsequent data received in the subscriber > will use the relation id received from the publisher and apply the > changes in the subscriber. Hm. I spent some time cleaning up this patch, and found that there's still a problem. ISTM that the row with value "3" ought to end up in the subscriber's sch2.t1 table, but it does not: the attached test script fails with t/100_bugs.pl .. 6/? # Failed test 'check data in subscriber sch2.t1 after schema rename' # at t/100_bugs.pl line 361. # got: '' # expected: '3' # Looks like you failed 1 test of 9. t/100_bugs.pl .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/9 subtests What's up with that? regards, tom lane
Commits
-
Invalidate pgoutput's replication-decisions cache upon schema rename.
- cd4b2334db49 16.0 landed
-
Add wait_for_subscription_sync for TAP tests.
- 0c20dd33db16 16.0 cited
-
Unify PostgresNode's new() and get_new_node() methods
- 201a76183e20 15.0 cited