Re: Nicer error when connecting to standby with hot_standby=off - Mailing list pgsql-hackers

From James Coleman
Subject Re: Nicer error when connecting to standby with hot_standby=off
Date
Msg-id CAAaqYe-LsyU3GOWNo1ruwzRrh3tH+Vwhn1ZEHMHjLwcCgUi_iw@mail.gmail.com
Whole thread Raw
In response to Re: Nicer error when connecting to standby with hot_standby=off  (David Zhang <david.zhang@highgo.ca>)
Responses Re: Nicer error when connecting to standby with hot_standby=off  (Fujii Masao <masao.fujii@oss.nttdata.com>)
List pgsql-hackers
On Thu, Apr 2, 2020 at 5:53 PM David Zhang <david.zhang@highgo.ca> wrote:
>
> The following review has been posted through the commitfest application:
> make installcheck-world:  not tested
> Implements feature:       tested, passed
> Spec compliant:           not tested
> Documentation:            not tested
>
> I applied the patch to the latest master branch and run a test below. The error messages have been separated. Below
isthe test steps.
 
>
> ### setup primary server
> initdb -D /tmp/primary/data
> mkdir /tmp/archive_dir
> echo "archive_mode='on'" >> /tmp/primary/data/postgresql.conf
> echo "archive_command='cp %p /tmp/archive_dir/%f'" >> /tmp/primary/data/postgresql.conf
> pg_ctl -D /tmp/primary/data -l /tmp/primary-logs start
>
> ### setup host standby server
> pg_basebackup -p 5432 -w -R -D /tmp/hotstandby
> echo "primary_conninfo='host=127.0.0.1 port=5432 user=pgdev'" >> /tmp/hotstandby/postgresql.conf
> echo "restore_command='cp /tmp/archive_dir/%f %p'" >> /tmp/hotstandby/postgresql.conf
> echo "hot_standby = off" >> /tmp/hotstandby/postgresql.conf
> pg_ctl -D /tmp/hotstandby -l /tmp/hotstandby-logs -o "-p 5433" start
>
> ### keep trying to connect to hot standby server in order to get the error messages in different stages.
> while true; do echo "`date`"; psql postgres -p 5433 -c "SELECT txid_current_snapshot();" sleep 0.2; done
>
> ### before the patch
> psql: error: could not connect to server: FATAL:  the database system is starting up
> ...
>
> ### after the patch, got different messages, one message indicates hot_standby is off
> psql: error: could not connect to server: FATAL:  the database system is starting up
> ...
> psql: error: could not connect to server: FATAL:  the database system is up, but hot_standby is off
> ...

Thanks for the review and testing!

James



pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: User Interface for WAL usage data
Next
From: Robert Haas
Date:
Subject: Re: zombie connections