Re: Logical Replication WIP - Mailing list pgsql-hackers

From Steve Singer
Subject Re: Logical Replication WIP
Date
Msg-id 5828E30D.6080109@ssinger.info
Whole thread Raw
In response to Re: Logical Replication WIP  (Petr Jelinek <petr@2ndquadrant.com>)
Responses Re: Logical Replication WIP
List pgsql-hackers
On 10/31/2016 06:38 AM, Petr Jelinek wrote:
> On 31/10/16 00:52, Steve Singer 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.
>

Attached are some proposed documentation updates (to be applied ontop of
your 20161031 patch set)

Also

<sect1 id="logical-replication-publication">
   <title>Publication</title>


+  <para>
+    The tables are matched using fully qualified table name. Renaming of
+    tables or schemas is not supported.
+  </para>

Is renaming of tables any less supported than other DDL operations
For example

alter table nokey2 rename to nokey3
select * FROM pg_publication_tables ;
  pubname | schemaname | tablename
---------+------------+-----------
  tpub    | public     | nokey3
(1 row)


If I then kill the postmaster on my subscriber and restart it, I get

2016-11-13 16:17:11.341 EST [29488] FATAL:  the logical replication
target public.nokey3 not found
2016-11-13 16:17:11.342 EST [29272] LOG:  worker process: logical
replication worker 41076 (PID 29488) exited with exit code 1
2016-11-13 16:17:16.350 EST [29496] LOG:  logical replication apply for
subscription nokeysub started
2016-11-13 16:17:16.358 EST [29498] LOG:  logical replication sync for
subscription nokeysub, table nokey2 started
2016-11-13 16:17:16.515 EST [29498] ERROR:  table public.nokey2 not
found on publisher
2016-11-13 16:17:16.517 EST [29272] LOG:  worker process: logical
replication worker 41076 sync 24688 (PID 29498) exited with exit code 1

but if I then rename the table on the subscriber everything seems to work.

(I suspect the need to kill+restart is a bug, I've seen other instances
where a hard restart of the subscriber following changes to is required)


I am also having issues adding a table to a publication ,it doesn't seem
work

P: create publication tpub for table a;
S: create subscription mysub connection 'host=localhost dbname=test
port=5440' publication tpub;
P: insert into a(b) values ('1');
P: alter publication tpub add table b;
P: insert into b(b) values ('1');
P: insert into a(b) values ('2');


select * FROM pg_publication_tables ;
  pubname | schemaname | tablename
---------+------------+-----------
  tpub    | public     | a
  tpub    | public     | b


but


S:  select * FROM b;
  a | b
---+---
(0 rows)
S: select * FROM a;
  a | b
---+---
  5 | 1
  6 | 2
(2 rows)



Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Improving RLS planning
Next
From: Tom Lane
Date:
Subject: Re: ExplainOneQuery_hook ignored for EXPLAIN EXECUTE