Обсуждение: Postgres 9.1 Synchronous Replication and stuck queries during sync repl setup
Postgres 9.1 Synchronous Replication and stuck queries during sync repl setup
От
Manoj Govindassamy
Дата:
Hi, I have configured PG master and slave to run under synchronous replication mode and they are mostly working fine. Exceptduring the setup phase. Please read thru my setup, procedure and let me know if I am doing something stupid. PG master : wal_level = hot_standby max_wal_senders = 5 wal_keep_segments = 10 synchronous_standby_names = 'standby' PG Slave wal_level = hot_standby max_wal_senders = 5 wal_keep_segments = 10 synchronous_standby_names = '' PG master has right hba entries for Slave PG Slave gets fresh backup from PG master using pg_backup utility everytime before it starts up When PG Master is restarted with above config for synchronous replication (pg_log file shows following happenings ..) 1. starts to accept connections 2. gets notified about standby connected 3. and after some time like 20 - 30 sec, both PG master and PG slave are in good sync replication setup. I noticed the pg_replication_statusmoving from potential -->async-->sync during this time. 4. statements are sync replicated And, Here is the problem during PG Master startup under sync replication setup -- Many SQL queries (including select) that are executed between (2) and (3) of above are getting stuck totally -- I am triggering DB checkpoint once in 5 seconds during the Master startup phase so that it can get into sync replicationsetup with slave sooner Questions: A. I need to know why PG master started accepting connections at (1) and still NOT able to fully commit the transactions.Statements that are executed after (3) are not seeing this problem. B. How do I make these statements timeout faster than stuck forever. statement_timeout config param is not helping here. any help is much appreciated. thanks, Manoj