Обсуждение: [HACKERS] Issues with replication slots(which created manually) against logicalreplication

Поиск
Список
Период
Сортировка
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




On Tue, May 9, 2017 at 5:59 AM, tushar <tushar.ahuja@enterprisedb.com> 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



Re: Issues with replication slots(which created manually) againstlogical replication

От
freebsdjlu
Дата:
Hi 
I also met the same issue :
WAL stream: ERROR:  option "proto_version" = "1" is unknown

do you know what is the root cause ?

thanks !



--
Sent from: https://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html



Re: Issues with replication slots(which created manually) againstlogical replication

От
Masahiko Sawada
Дата:
On Mon, 6 Apr 2020 at 23:32, freebsdjlu <freebsdjlu@gmail.com> wrote:
>
> Hi
> I also met the same issue :
> WAL stream: ERROR:  option "proto_version" = "1" is unknown
>
> do you know what is the root cause ?
>

It's usually a good idea to provide reproducible steps along with the
error you're having.

I suspect the error message came from contrib/test_decoding, and
'proto_version' option is used when starting logical replication. So
as far as I can imagine from the error message, I think that a server
attempted to start logical replication using a replication slot that
uses test_decoding rather than pgoutput. I suggest to check the decode
plug-in of the replication slot on the provider server that is used
for logical replication.

Regards,

-- 
Masahiko Sawada            http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services