Re:[BUG] standby node can not provide service even it replays alllog files - Mailing list pgsql-hackers

From Thunder
Subject Re:[BUG] standby node can not provide service even it replays alllog files
Date
Msg-id 3f1cf8f7.6405.16ded602fce.Coremail.thunder1@126.com
Whole thread Raw
In response to [BUG] standby node can not provide service even it replays all logfiles  (Thunder <thunder1@126.com>)
Responses Re: [BUG] standby node can not provide service even it replays alllog files
List 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@126.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.



 



 

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Incorrect relation locked at beginning of REINDEX CONCURRENTLY
Next
From: Amit Kapila
Date:
Subject: Re: dropdb --force