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

From: Thunder <thunder1(at)126(dot)com>
To: 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 08:12:46
Message-ID: 3f1cf8f7.6405.16ded602fce.Coremail.thunder1@126.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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)

At 2019-10-21 15:40:24, "Thunder" <thunder1(at)126(dot)com> wrote:

Hi hackers,
I found this issue when restart standby node and then try to connect it.
It return "psql: FATAL: the database system is starting up".

The steps to reproduce this issue.
1. Create a session to run uncommit_trans.sql
2. Create the other session to do checkpoint
3. Restart standby node.
4. standby node can not provide service even it has replayed all log files.

I think the issue is in ProcArrayApplyRecoveryInfo function.
The standby state is in STANDBY_SNAPSHOT_PENDING, but the lastOverflowedXid is not committed.

Any idea to fix this issue?
Thanks.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2019-10-21 08:25:09 Re: dropdb --force
Previous Message Michael Paquier 2019-10-21 07:43:23 Incorrect relation locked at beginning of REINDEX CONCURRENTLY