Re: [HACKERS] Issues with replication slots(which created manually) against logical replication

2017-05-10 Thread Robert Haas
On Tue, May 9, 2017 at 5:59 AM, tushar  wrote:
> I think -we should throw an error while creating subscription.

I don't really think it's worth complicating the code to check for
this.  If you work hard enough, you can create up a configuration that
doesn't work.  So don't do that.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Issues with replication slots(which created manually) against logical replication

2017-05-09 Thread tushar

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



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers