max_connections and standby server

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: max_connections and standby server
Date: 2015-08-11 04:53:15
Message-ID: 20150811.135315.1828663916892680305.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Today I encountered an interesting situation.

1) A streaming replication primary server and a standby server is
running. At this point max_connections = 100 on both servers.

2) Shutdown both servers.

3) Change max_connections to 1100 on both servers and restart both
servers.

4) The primary server happily started but the standby server won't
because of lacking resource.

5) Shutdown both servers.

6) Restore max_connections to 100 on both servers and restart both
servers.

7) The primary server happily started but the standby server won't
because of the reason below.

32695 2015-08-11 13:46:22 JST FATAL: hot standby is not possible because max_connections = 100 is a lower setting than on the master server (its value was 1100)
32695 2015-08-11 13:46:22 JST CONTEXT: xlog redo parameter change: max_connections=1100 max_worker_processes=8 max_prepared_xacts=10 max_locks_per_xact=64 wal_level=hot_standby wal_log_hints=off
32693 2015-08-11 13:46:22 JST LOG: startup process (PID 32695) exited with exit code 1
32693 2015-08-11 13:46:22 JST LOG: terminating any other active server processes

I think this is because pg_control on the standby remembers that the
previous primary server's max_connections = 1100 even if the standby
server fails to start. Shouldn't we update pg_control file only when
standby succeeds to start?

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Waldemar Brodkorb 2015-08-11 05:10:47 Re: linux sparc compile issue
Previous Message Andrew Dunstan 2015-08-11 03:17:32 Re: [COMMITTERS] pgsql: Fix pg_dump to dump shell types.