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>
Subject: Re: Logical Replication WIP
Date: 2016-11-05 16:27:15
Message-ID: 581E0863.5060303@ssinger.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/31/2016 06:38 AM, Petr Jelinek wrote:
> There are some fundamental issues with initial sync that need to be
> discussed on list but this one is not known. I'll try to convert this
> to test case (seems like useful one) and fix it, thanks for the
> report. In meantime I realized I broke the last patch in the series
> during rebase so attached is the fixed version. It also contains the
> type info in the protocol.
>
>

I don't know if this is covered by the known initial_sync problems or not

If I have a 'all tables' publication and then create a new table the
data doesn't seem to replicate to the new table.

P: create table a(a serial4 primary key, b text);
S: create table a(a serial4 primary key, b text);
P: create publication mypub for all tables;
S: create subscription mysub connection 'host=localhost dbname=test
port=5441' publication mypub;
P: create table b(a serial4 primary key, b text);
P: insert into b(b) values ('foo2');
P: insert into a(b) values ('foo3');

Then I check my subscriber

select * FROM a;
a | b
---+------
1 | foo
2 | foo3
(2 rows)

test=# select * FROM b;
a | b
---+---
(0 rows)

However, if the table isn't on the subscriber I do get an error:

ie

P: create table c(a serial4 primary key, b text);
P: insert into c(b) values('foo');

2016-11-05 11:49:31.456 EDT [14938] FATAL: the logical replication
target public.c not found
2016-11-05 11:49:31.457 EDT [13703] LOG: worker process: logical
replication worker 16457 (PID 14938) exited with exit code 1

but if then add the table
S: create table c(a serial4 primary key, b text);
2016-11-05 11:51:08.583 EDT [15014] LOG: logical replication apply for
subscription mysub started

but the data doesn't replicate to table c either.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-11-05 17:13:29 Re: btree_gin and btree_gist for enums
Previous Message Andrew Dunstan 2016-11-05 16:12:19 Re: btree_gin and btree_gist for enums