Re: [BUG] standby node can not provide service even it replays all log files

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Thunder <thunder1(at)126(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [BUG] standby node can not provide service even it replays all log files
Date: 2019-10-21 17:27:58
Message-ID: CA+TgmoaVukLbVu=_RvUXDA6BUTz0e_PvNo2u_ka3fqpVzLWEJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 21, 2019 at 4:13 AM Thunder <thunder1(at)126(dot)com> wrote:
> Can we fix this issue like the following patch?
>
> $git diff src/backend/access/transam/xlog.c
> diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
> index 49ae97d4459..0fbdf6fd64a 100644
> --- a/src/backend/access/transam/xlog.c
> +++ b/src/backend/access/transam/xlog.c
> @@ -8365,7 +8365,7 @@ CheckRecoveryConsistency(void)
> * run? If so, we can tell postmaster that the database is consistent now,
> * enabling connections.
> */
> - if (standbyState == STANDBY_SNAPSHOT_READY &&
> + if ((standbyState == STANDBY_SNAPSHOT_READY || standbyState == STANDBY_SNAPSHOT_PENDING) &&
> !LocalHotStandbyActive &&
> reachedConsistency &&
> IsUnderPostmaster)

I think that the issue you've encountered is design behavior. In
other words, it's intended to work that way.

The comments for the code you propose to change say that we can allow
connections once we've got a valid snapshot. So presumably the effect
of your change would be to allow connections even though we don't have
a valid snapshot.

That seems bad.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2019-10-21 17:34:40 Re: Ordering of header file inclusion
Previous Message Robert Haas 2019-10-21 17:19:19 Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?