public inbox for [email protected]  
help / color / mirror / Atom feed
From: tushar <[email protected]>
To: Andres Freund <[email protected]>
Cc: Petr Jelinek <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Craig Ringer <[email protected]>
Cc: Petr Jelinek <[email protected]>
Cc: [email protected]
Subject: Re: Minimal logical decoding on standbys
Date: Mon, 4 Mar 2019 16:54:32 +0530
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On 03/01/2019 11:16 PM, Andres Freund wrote:
> So, if I understand correctly you do*not*  have a phyiscal replication
> slot for this standby? For the feature to work reliably that needs to
> exist, and you need to have hot_standby_feedback enabled. Does having
> that fix the issue?

Ok, This time around  - I performed like this -

.)Master cluster (set wal_level=logical and hot_standby_feedback=on in 
postgresql.conf) , start the server and create a physical replication slot

postgres=# SELECT * FROM 
pg_create_physical_replication_slot('decoding_standby');
     slot_name     | lsn
------------------+-----
  decoding_standby |
(1 row)

.)Perform pg_basebackup using --slot=decoding_standby  with option -R . 
modify port=5555 , start the server

.)Connect to slave and create a logical replication slot

postgres=# create table t(n int);
ERROR:  cannot execute CREATE TABLE in a read-only transaction
postgres=#

postgres=# SELECT * FROM 
pg_create_logical_replication_slot('standby_slot', 'test_decoding');
   slot_name   |    lsn
--------------+-----------
  standby_slot | 0/2000060
(1 row)

run pgbench (./pgbench -i -s 10 postgres) against  master and 
simultaneously- start  pg_recvlogical  , provide port=5555 ( slave 
cluster)  and specify slot=standby_slot
./pg_recvlogical -d postgres  -p 5555 -s 1 -F 1  -v --slot=standby_slot  
--start -f -


[centos@centos-cpula bin]$ ./pg_recvlogical -d postgres  -p 5555 -s 1 -F 
1  -v --slot=standby_slot  --start -f -
pg_recvlogical: starting log streaming at 0/0 (slot standby_slot)
pg_recvlogical: streaming initiated
pg_recvlogical: confirming write up to 0/0, flush to 0/0 (slot standby_slot)
pg_recvlogical: confirming write up to 0/30194E8, flush to 0/30194E8 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3019590, flush to 0/3019590 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3019590, flush to 0/3019590 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3019590, flush to 0/3019590 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3019590, flush to 0/3019590 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3019590, flush to 0/3019590 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3019590, flush to 0/3019590 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3019590, flush to 0/3019590 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3019590, flush to 0/3019590 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3019590, flush to 0/3019590 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/301D558, flush to 0/301D558 
(slot standby_slot)
BEGIN 476
COMMIT 476
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
pg_recvlogical: confirming write up to 0/3034B40, flush to 0/3034B40 
(slot standby_slot)
BEGIN 477
COMMIT 477

If we do the same for the logical replication slot which created on 
Master cluster

[centos@centos-cpula bin]$ ./pg_recvlogical -d postgres  -s 1 -F 1 -v 
--slot=master_slot  --start -f -
pg_recvlogical: starting log streaming at 0/0 (slot master_slot)
pg_recvlogical: streaming initiated
pg_recvlogical: confirming write up to 0/0, flush to 0/0 (slot master_slot)
table public.pgbench_accounts: INSERT: aid[integer]:65057 bid[integer]:1 
abalance[integer]:0 filler[character]:' '
table public.pgbench_accounts: INSERT: aid[integer]:65058 bid[integer]:1 
abalance[integer]:0 filler[character]:' '
table public.pgbench_accounts: INSERT: aid[integer]:65059 bid[integer]:1 
abalance[integer]:0 filler[character]:' '
table public.pgbench_accounts: INSERT: aid[integer]:65060 bid[integer]:1 
abalance[integer]:0 filler[character]:' '
table public.pgbench_accounts: INSERT: aid[integer]:65061 bid[integer]:1 
abalance[integer]:0 filler[character]:' '
table public.pgbench_accounts: INSERT: aid[integer]:65062 bid[integer]:1 
abalance[integer]:0 filler[character]:' '
table public.pgbench_accounts: INSERT: aid[integer]:65063 bid[integer]:1 
abalance[integer]:0 filler[character]:' '
table public.pgbench_accounts: INSERT: aid[integer]:65064 bid[integer]:1 
abalance[integer]:0 filler[character]:' '

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



view thread (196+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Minimal logical decoding on standbys
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox