Re: Logical Replication WIP

From: Steve Singer <steve(at)ssinger(dot)info>
To: Petr Jelinek <petr(at)2ndquadrant(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Erik Rijkers <er(at)xs4all(dot)nl>
Subject: Re: Logical Replication WIP
Date: 2016-09-19 02:13:33
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 09/08/2016 06:59 PM, Petr Jelinek wrote:
> Hi,
> Updated version, this should address most of the things in Peter's
> reviews so far, not all though as some of it needs more discussion.

Another bug report.

I had subscribed a subscriber database to a publication with 1 table
create table a (a serial4 primary key, b text);

* I then dropped column b on the subscriber
* inserted some rows on the publisher
* Noticed the expected error about column b not existing in the
subscriber log
* Added column c on the subscriber, then added column b after column C

I now get the following stack trace

#1 0x00000000007dc8f9 in cstring_to_text (
s=0x16f238af0 <error: Cannot access memory at address 0x16f238af0>)
at varlena.c:152
#2 0x00000000008046a3 in InputFunctionCall (
str=str(at)entry=0x16f238af0 <error: Cannot access memory at address
0x16f238af0>, typioparam=typioparam(at)entry=25, typmod=typmod(at)entry=-1) at
#3 0x0000000000804971 in OidInputFunctionCall (functionId=<optimized out>,
str=0x16f238af0 <error: Cannot access memory at address 0x16f238af0>,
typioparam=25, typmod=-1) at fmgr.c:2040
#4 0x00000000006aa485 in SlotStoreCStrings (slot=0x2748670,
values=0x7fffa02d0330) at apply.c:569
#5 0x00000000006ab45c in handle_insert (s=0x274d088) at apply.c:756
#6 0x00000000006abcea in handle_message (s=0x7fffa02d3e20) at apply.c:978
#7 LogicalRepApplyLoop (last_received=117457680) at apply.c:1146
#8 0x00000000006ac37e in ApplyWorkerMain (main_arg=<optimized out>)
at apply.c:1530

In SlotStoreCStrings values only has 2 elements but natts is 4

> Changes:
> - I moved the publication.c to pg_publication.c, subscription.c to
> pg_subscription.c.
> - changed \drp and \drs to \dRp and \dRs
> - fixed definitions of the catalogs (BKI_ROWTYPE_OID)
> - changed some GetPublication calls to get_publication_name
> - fixed getObjectIdentityParts for OCLASS_PUBLICATION_REL
> - fixed get_object_address_publication_rel
> - fixed the dependencies between pkeys and publications, for this I
> actually had to add new interface to depenency.c that allows dropping
> single dependency
> - fixed the 'for all tables' and 'for tables all in schema' publications
> - changed the alter publication from FOR to SET
> - added more test cases for the publication DDL
> - fixed compilation of subscription patch alone and docs
> - changed subpublications to name[]
> - added check for publication list duplicates
> - made the subscriptions behave more like they are inside the database
> instead of shared catalog (even though the catalog is still shared)
> - added options for for CREATE SUBSCRIPTION to optionally not create
> slot and not do the initial data sync - that should solve the
> complaint about CREATE SUBSCRIPTION always connecting
> - the CREATE SUBSCRIPTION also tries to check if the specified
> connection connects back to same db (although that check is somewhat
> imperfect) and if it gets stuck on create slot it should be normally
> cancelable (that should solve the issue Steve Singer had)
> - fixed the tests to work in any timezone
> - added DDL regress tests for subscription
> - added proper detection of missing schemas and tables on subscriber
> - rebased on top of 19acee8 as the DefElem changes broke the patch
> The table sync is still far from ready.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2016-09-19 04:02:54 Re: PoC: Make it possible to disallow WHERE-less UPDATE and DELETE
Previous Message Vladimir Gordiychuk 2016-09-18 23:12:04 Re: Stopping logical replication protocol