Postgres 9.1 Synchronous Replication and stuck queries during sync repl setup

From: Manoj Govindassamy <manoj(at)nimblestorage(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Postgres 9.1 Synchronous Replication and stuck queries during sync repl setup
Date: 2012-06-06 06:54:30
Message-ID: ADD354851455FC44A5D8923AD5152DE307A0FA07@coloex01.nimblestorage.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Hi,

I have configured PG master and slave to run under synchronous replication mode and they are mostly working fine. Except during 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_status moving 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 replication setup 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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message hari.fuchs 2012-06-06 08:06:25 Re: Can schemas be ordered regarding their creation time ?
Previous Message shuaixf 2012-06-06 05:13:20 Re: Could the unlogged table of postgresql be used as session?

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2012-06-06 07:05:20 Re: Partitioning Advice
Previous Message Mike Christensen 2012-06-06 05:50:16 Re: I'd like to learn a bit more about how indexes work