Issues with replication slots(which created manually) against logical replication

From: tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Issues with replication slots(which created manually) against logical replication
Date: 2017-05-09 09:59:08
Message-ID: e3734330-ceb3-b833-cacc-6c0c696f0cbd@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

While testing 'logical replication' against v10 , i encountered couple
of issue when created logical/physical slot manually.

Case 1 - when used with logical replication slot (which created manually)
Publication Server(X)
\\ Make sure wal_level is set to logical in postgresql.conf file
\\create table/Insert 1 row -> create table test(n int); insert into t
values (1);
\\create publication for all -> create publication pub for table t;
\\create logical replication slot but before that - do 'make and make
install' against "contrib/test_decoding" contrib folder
select * from
pg_create_logical_replication_slot('my_logical','test_decoding');

Subscription Serve(Y)
\\ Make sure wal_level is set to logical in postgresql.conf file
\\create table -> create table test(n int);
\\create Subscription , used the existing slot

postgres=# CREATE SUBSCRIPTION sub CONNECTION 'host=localhost
dbname=postgres port=5000 user=centos ' publication pub with (NOCREATE
SLOT ,Slot name=my_logical);
NOTICE: synchronized table states
CREATE SUBSCRIPTION

if we check the publication server (x) and subscription server(y) , we
are getting this error in log file -

2017-05-09 10:41:49.570 BST [1809] LOG: starting logical replication
worker for subscription "sub"
2017-05-09 10:41:49.579 BST [2346] LOG: logical replication apply for
subscription sub started
2017-05-09 10:41:49.588 BST [2346] ERROR: could not receive data from
WAL stream: ERROR: option "proto_version" = "1" is unknown
CONTEXT: slot "my_logical", output plugin "test_decoding", in the
startup callback
2017-05-09 10:41:49.589 BST [1801] LOG: worker process: logical
replication worker for subscription 16391 (PID 2346) exited with exit code 1

Case 2 -When used with physical replication slot

Publication Server(X)
\\ Make sure wal_level is set to logical in postgresql.conf file
\\create table/Insert 1 row -> create table test(n int); insert into t
values (1);
\\create publication for all -> create publication pub for table t;

\\create physical replication slot
postgres=# select * from pg_create_physical_replication_slot('my_test');
slot_name | wal_position
-----------+--------------
my_test |
(1 row)

Subscription Serve(Y)
\\ Make sure wal_level is set to logical in postgresql.conf file
\\create table -> create table test(n int);
\\create Subscription , used the existing slot ,which is physical

postgres=# CREATE SUBSCRIPTION sub CONNECTION 'host=localhost
dbname=postgres port=5000 user=centos ' publication pub with (NOCREATE
SLOT ,Slot name=my_test);
NOTICE: synchronized table states
CREATE SUBSCRIPTION
postgres=#

in the subscription server log file , we are getting this error -

2017-05-09 10:51:44.037 BST [2738] ERROR: could not receive data from
WAL stream: ERROR: cannot use physical replication slot for logical
decoding
2017-05-09 10:51:44.038 BST [1801] LOG: worker process: logical
replication worker for subscription 16393 (PID 2738) exited with exit code 1

I think -we should throw an error while creating subscription.

--
regards,tushar
EnterpriseDB https://www.enterprisedb.com/
The Enterprise PostgreSQL Company

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2017-05-09 09:59:28 Re: Bug in pg_dump --table and --exclude-table for declarative partition table handling.
Previous Message Petr Jelinek 2017-05-09 09:54:52 Re: logical replication syntax (was DROP SUBSCRIPTION, query cancellations and slot handling)