Fwd: Re: BUG #15589: Due to missing wal, restore ends prematurely and opens database for read/write

From: leif(at)lako(dot)no
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Fwd: Re: BUG #15589: Due to missing wal, restore ends prematurely and opens database for read/write
Date: 2019-01-30 15:53:51
Message-ID: a3bf3b8910cd5adb8a5fbc8113eac0ab@lako.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hi
I have reported a bug via PostgreSQL bug report form, but havent got any response so far.
This might not be a bug, but a feature not implemented yet.
I suggest to make a small addition to StartupXLOG to solve the issue.

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 2ab7d804f0..d0e5bb3f84 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7277,6 +7277,19 @@ StartupXLOG(void)

case RECOVERY_TARGET_ACTION_PROMOTE:
break;
+ }
+ } else if (recoveryTarget == RECOVERY_TARGET_TIME)
+ {
+ /*
+ * Stop point not reached but next WAL could not be read
+ * Some explanation and warning should be logged
+ */
+ switch (recoveryTargetAction)
+ {
+ case RECOVERY_TARGET_ACTION_PAUSE:
+ SetRecoveryPause(true);
+ recoveryPausesHere();
+ break;
}
}

The scenario I want to solve is:
Need to restore backup to another server.
Restores pgbasebackup files
Restores som wal-files
Extract pgbasebackup files
creates recover.conf with pit
Starts postgresql
recover ends before pit due to missing wal-files
database opens read/write

I think database should have paused recovery then I could restore
additional wal-files and restart postgresql to continue with recover.

With large databases and a lot of wal-files it is time consuming to repeat parts of the process.

Best regards
Leif Gunnar Erlandsen

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-01-30 16:25:57 Re: BUG #15613: Bug in PG Planner for Foreign Data Wrappers
Previous Message Etsuro Fujita 2019-01-30 12:31:56 Re: BUG #15613: Bug in PG Planner for Foreign Data Wrappers

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2019-01-30 16:00:07 Re: proposal: new polymorphic types - commontype and commontypearray
Previous Message Daniel Verite 2019-01-30 15:30:54 Re: insensitive collations