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

From leif@lako.no
Subject Fwd: Re: BUG #15589: Due to missing wal, restore ends prematurely and opens database for read/write
Date
Msg-id a3bf3b8910cd5adb8a5fbc8113eac0ab@lako.no
Whole thread Raw
Responses Re: BUG #15589: Due to missing wal, restore ends prematurely andopens database for read/write  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
List 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


pgsql-hackers by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: insensitive collations
Next
From: Pavel Stehule
Date:
Subject: Re: proposal: new polymorphic types - commontype and commontypearray