pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: leif@lako.no
To: Jeff Janes <jeff.janes@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15589: Due to missing wal, restore ends prematurely and opens database for read/write
Date: Sat, 12 Jan 2019 07:40:07 +0000
Message-ID: <d8b925764876064175d94447e698ec69@lako.no> (raw)
In-Reply-To: <CAMkU=1ym=UYLVS37NNSE547Uw0_xPJUuBmyZPqEHARd=Un6eiA@mail.gmail.com>
References: <CAMkU=1ym=UYLVS37NNSE547Uw0_xPJUuBmyZPqEHARd=Un6eiA@mail.gmail.com>
	<15589-8e6e353a97b085fb@postgresql.org>

"Jeff Janes" <jeff.janes@gmail.com (mailto:jeff.janes@gmail.com?to=%22Jeff%20Janes%22%20<jeff.janes@gmail.com>)> skrev 11. januar 2019 kl. 15:03:
 On Fri, Jan 11, 2019 at 4:08 AM PG Bug reporting form <noreply@postgresql.org (mailto:noreply@postgresql.org)> wrote: 
PostgreSQL should have paused recovery also on the first scenario. Then I
could have added missing wal and continued with restore. 
At the least, I think we should log an explicit WARNING if the WAL stream ends before the specified PIT is reached. 
  The documentation for recovery.conf states that with recovery_target_time set recovery_target_action defaults to pause.
Even if stop point is not reached, pause should be activated.
After checking the source this might be solved with a small addition in StartupXLOG.c
Someone with more experience with the source code should check this out.
 if (reachedStopPoint)  
{ 
  if (!reachedConsistency)  
  ereport(FATAL,  
  (errmsg("requested recovery stop point is before consistent recovery point")));  
  /*  
 * This is the last point where we can restart recovery with a 
 * new recovery target, if we shutdown and begin again. After 
 * this, Resource Managers may choose to do permanent 
 * corrective actions at end of recovery. 
 */ 
  switch (recoveryTargetAction)  
 { 
  case RECOVERY_TARGET_ACTION_SHUTDOWN:  
  /*  
 * exit with special return code to request shutdown 
 * of postmaster. Log messages issued from 
 * postmaster. 
 */ 
  proc_exit(3);  
  case RECOVERY_TARGET_ACTION_PAUSE:  
  SetRecoveryPause(true);  
  recoveryPausesHere();  
  /* drop into promote */  
  case RECOVERY_TARGET_ACTION_PROMOTE:  
  break;  
 } 
 /* Add these lines .... */   
 } 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;  
 } 
} 
/* .... until here */  
--

Leif

view thread (10+ messages)  latest in thread

Message-ID: <d8b925764876064175d94447e698ec69@lako.no>
Permalink:  ../d8b925764876064175d94447e698ec69@lako.no/
Also on:    postgresql.org/message-id/d8b925764876064175d94447e698ec69@lako.no

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: leif@lako.no, jeff.janes@gmail.com
  Subject: Re: BUG #15589: Due to missing wal, restore ends prematurely and opens database for read/write
  In-Reply-To: <d8b925764876064175d94447e698ec69@lako.no>
  References: <CAMkU=1ym=UYLVS37NNSE547Uw0_xPJUuBmyZPqEHARd=Un6eiA@mail.gmail.com> <15589-8e6e353a97b085fb@postgresql.org> <d8b925764876064175d94447e698ec69@lako.no>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox