Re: Nicer error when connecting to standby with hot_standby=off

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, James Coleman <jtc331(at)gmail(dot)com>, David Steele <david(at)pgmasters(dot)net>, David Zhang <david(dot)zhang(at)highgo(dot)ca>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Nicer error when connecting to standby with hot_standby=off
Date: 2021-03-07 17:11:09
Message-ID: CABUevEza0Bik0dwNPmivkVX9ScKWr-sYCb=v0L0RfQWfbBD41Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 7, 2021 at 3:39 PM Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
>
>
>
> On 2021/03/06 5:37, Alvaro Herrera wrote:
> > On 2021-Mar-05, James Coleman wrote:
> >
> >> Do you have any thoughts on what you'd like to see the message be? I
> >> could change the PM_RECOVERY (without hot standby enabled) to return
> >> CAC_RECOVERY which would give us the message "the database system is
> >> in recovery mode", but that would be a change from what that state
> >> returns now in a way that's unrelated to the goal of the patch.
> >
> > Here's an idea:
> >
> > * hot_standby=on, before reaching consistent state
> > FATAL: database is not accepting connections
> > DETAIL: Consistent state has not yet been reached.
> >
> > * hot_standby=off, past consistent state
> > FATAL: database is not accepting connections
> > DETAIL: Hot standby mode is disabled.
> >
> > * hot_standby=off, before reaching consistent state
> > FATAL: database is not accepting connections
>
> This idea looks good to me!

+1.

> > DETAIL: Hot standby mode is disabled.
> > or maybe
> > DETAIL: Consistent state has not yet been reached, and hot standby mode is disabled.
>
> I prefer the former message. Because the latter message meams that
> we need to output the different messages based on whether the consistent
> state is reached or not, and the followings would be necessary to implement
> that. This looks a bit overkill to me against the purpose, at least for me.

Agreed. If hot standby is off, why would the admin care about whether
it's consistent yet or not?

--
Magnus Hagander
Me: https://www.hagander.net/
Work: https://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-03-07 18:29:42 Why isn't pg_stat_get_subscription() marked as proretset?
Previous Message Zhihong Yu 2021-03-07 16:45:33 Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW