pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: 厚积薄发 <postgresql_2016@163.com>
To: pgsql-bugs@postgresql.org
Subject: When I set the synchronous_standby_names and synchronous_commit to off, the replication query state also show in sync mode.
Date: Thu, 6 Oct 2016 17:00:04 -0700 (MST)
Message-ID: <1475798404178-5924787.post@n3.nabble.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

When I use the sync replation in PG9.6, I find a question about the query
state display.The following is the testing steps:

1) set the postgresql.conf parameter

synchronous_standby_names = '5(*)'

synchronous_commit = on

2) start the standby node ,and query the replication state

It shows that the replication in the sync mode.

postgres=# select * from pg_stat_replication;
-[ RECORD 1 ]----+------------------------------
pid              | 2650
usesysid         | 10
usename          | houjibofa
application_name | walreceiver
client_addr      | 127.0.0.1
client_hostname  | 
client_port      | 50816
backend_start    | 2016-10-07 15:32:22.179723+08
backend_xmin     | 
state            | streaming
sent_location    | 0/70000F4
write_location   | 0/70000F4
flush_location   | 0/70000F4
replay_location  | 0/70000F4
sync_priority    | 1
sync_state       | sync

postgres=# show synchronous_commit;
-[ RECORD 1 ]------+---
synchronous_commit | on

4) set the synchronous_commit  to off, using the pg_ctl reload method

postgres=# show synchronous_commit;
-[ RECORD 1 ]------+----
synchronous_commit | off

postgres=# select * from pg_stat_replication;
-[ RECORD 1 ]----+------------------------------
pid              | 2650
usesysid         | 10
usename          | houjibofa
application_name | walreceiver
client_addr      | 127.0.0.1
client_hostname  | 
client_port      | 50816
backend_start    | 2016-10-07 15:32:22.179723+08
backend_xmin     | 
state            | streaming
sent_location    | 0/70000F4
write_location   | 0/70000F4
flush_location   | 0/70000F4
replay_location  | 0/70000F4
sync_priority    | 1
sync_state       | sync


It also shows in the sync replication mode, however, it is in the async
mode. And I can create a table in the primary mode.
postgres=# show synchronous_standby_names;
-[ RECORD 1 ]-------------+-----
synchronous_standby_names | 5(*)

postgres=# create table test(a int);
CREATE TABLE

The PG version is follows.

postgres=# select version();
                                                version                              
                   
-------------------------------------------------------------------------------------
-------------------
 PostgreSQL 9.6.0 on i686-pc-linux-gnu, compiled by gcc (Ubuntu
5.3.1-14ubuntu2) 5.3.
1 20160413, 32-bit
(1 row)


I think the reason is that when get the replication priority in the function
SyncRepGetStandbyPriority, it does not consider the 
parameter synchronous_commit. So if we set the synchronous_standby_names
parameter and the standby fit the setting, no matter whether sync or not,
it's priority will not equal to 0.









--
View this message in context: http://postgresql.nabble.com/When-I-set-the-synchronous-standby-names-and-synchronous-commit-to-off-...
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.


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



view thread (6+ messages)  latest in thread

Message-ID: <1475798404178-5924787.post@n3.nabble.com>
Permalink:  ../1475798404178-5924787.post@n3.nabble.com/
Also on:    postgresql.org/message-id/1475798404178-5924787.post@n3.nabble.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: postgresql_2016@163.com
  Subject: Re: When I set the synchronous_standby_names and synchronous_commit to off, the replication query state also show in sync mode.
  In-Reply-To: <1475798404178-5924787.post@n3.nabble.com>
  References: <1475798404178-5924787.post@n3.nabble.com>

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

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