Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gosBZ-0000mU-DL for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Jan 2019 15:53:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gosBX-0000No-Tp for pgsql-hackers@arkaria.postgresql.org; Wed, 30 Jan 2019 15:53:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gosBX-0000Ng-Mj for pgsql-hackers@lists.postgresql.org; Wed, 30 Jan 2019 15:53:55 +0000 Received: from server2.lako.no ([77.235.58.136]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gosBV-0005G6-Ht for pgsql-hackers@lists.postgresql.org; Wed, 30 Jan 2019 15:53:54 +0000 Received: from webmail.lako.no (localhost [127.0.0.1]) (authenticated bits=0) by server2.lako.no (8.14.7/8.14.7) with ESMTP id x0UFrpdd027918 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 30 Jan 2019 16:53:52 +0100 MIME-Version: 1.0 Date: Wed, 30 Jan 2019 15:53:51 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: RainLoop/1.12.1 From: leif@lako.no Message-ID: Subject: Fwd: Re: BUG #15589: Due to missing wal, restore ends prematurely and opens database for read/write To: pgsql-hackers@lists.postgresql.org In-Reply-To: References: <15589-8e6e353a97b085fb@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi=0AI have reported a bug via PostgreSQL bug report form, but havent got= any response so far.=0AThis might not be a bug, but a feature not implem= ented yet.=0AI suggest to make a small addition to StartupXLOG to solve t= he issue.=0A=0A=0A=0Agit diff src/backend/access/transam/xlog.c=0Adiff --= git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog= .c=0Aindex 2ab7d804f0..d0e5bb3f84 100644=0A--- a/src/backend/access/trans= am/xlog.c=0A+++ b/src/backend/access/transam/xlog.c=0A@@ -7277,6 +7277,19= @@ StartupXLOG(void)=0A =0A case = RECOVERY_TARGET_ACTION_PROMOTE:=0A = break;=0A+ } =0A+ = } else if (recoveryTarget =3D=3D RECOVERY_TARGET_TIME)=0A+ = {=0A+ /*=0A+ = * Stop point not reached but next WAL could not be read=0A= + * Some explanation and warning should be= logged=0A+ */=0A+ = switch (recoveryTargetAction)=0A+ {= =0A+ case RECOVERY_TARGET_ACTION_PA= USE:=0A+ SetRecoveryPause(true);=0A= + recoveryPausesHere();=0A+ = break;=0A }= =0A }=0A=0A=0A=0A=0A=0AThe scenario I want to solv= e is:=0ANeed to restore backup to another server.=0A Restores pgbasebacku= p files=0A Restores som wal-files=0A Extract pgbasebackup files=0A create= s recover.conf with pit=0A Starts postgresql=0A recover ends before pit d= ue to missing wal-files=0A database opens read/write=0A=0AI think databas= e should have paused recovery then I could restore =0Aadditional wal-file= s and restart postgresql to continue with recover.=0A=0AWith large databa= ses and a lot of wal-files it is time consuming to repeat parts of the pr= ocess.=0A=0ABest regards=0ALeif Gunnar Erlandsen