public inbox for [email protected]  
help / color / mirror / Atom feed
From: Fujii Masao <[email protected]>
To: Heikki Linnakangas <[email protected]>
Cc: Simon Riggs <[email protected]>
Cc: Aidan Van Dyk <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Re: [COMMITTERS] pgsql: Make standby server continuously retry restoring the next WAL
Date: Wed, 24 Mar 2010 22:20:45 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<1268988724.3556.3.camel@ebony>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On Wed, Mar 24, 2010 at 9:31 PM, Heikki Linnakangas
<[email protected]> wrote:
> Hmm, true, this changes behavior over previous releases. I tend to think
> that it's always an error if there's a corrupt file in the archive,
> though, and PANIC is appropriate. If the administrator wants to start up
> the database anyway, he can remove the corrupt file from the archive and
> place it directly in pg_xlog instead.

Okay.

> Thanks. That's easily fixable (applies over the previous patch):
>
> --- a/src/backend/access/transam/xlog.c
> +++ b/src/backend/access/transam/xlog.c
> @@ -3773,7 +3773,7 @@ retry:
>                pagelsn.xrecoff = 0;
>            }
>            /* Wait for the next page to become available */
> -           if (!XLogPageRead(&pagelsn, emode, false, false))
> +           if (!XLogPageRead(&pagelsn, emode_arg, false, false))
>                return NULL;
>
>            /* Check that the continuation record looks valid */

Seems correct.

> sources &= ~failedSources;
> failedSources |= readSource;

The above lines in XLogPageRead() seem not to be required in normal
recovery case (i.e., standby_mode = off). So how about the attached
patch?

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


Attachments:

  [application/octet-stream] failedSource_v1.patch (777B, 2-failedSource_v1.patch)
  download | inline diff:
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 8943,8949 **** retry:
  				sources = XLOG_FROM_PG_XLOG;
  				if (InArchiveRecovery)
  					sources |= XLOG_FROM_ARCHIVE;
- 				sources &= ~failedSources;
  
  				readFile = XLogFileReadAnyTLI(readId, readSeg, emode_arg,
  											  sources);
--- 8943,8948 ----
***************
*** 9041,9048 **** retry:
  	return true;
  
  next_record_is_invalid:
- 	failedSources |= readSource;
- 
  	if (readFile >= 0)
  		close(readFile);
  	readFile = -1;
--- 9040,9045 ----
***************
*** 9050,9056 **** next_record_is_invalid:
--- 9047,9056 ----
  	readSource = 0;
  
  	if (StandbyMode)
+ 	{
+ 		failedSources |= readSource;
  		goto retry;
+ 	}
  	else
  		return false;
  


view thread (77+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Re: [COMMITTERS] pgsql: Make standby server continuously retry restoring the next WAL
  In-Reply-To: <[email protected]>

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

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