Re: Include WAL in base backup

Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>

From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Magnus Hagander <magnus@hagander.net>, Tom Lane <tgl@sss.pgh.pa.us>, Stephen Frost <sfrost@snowman.net>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2011-01-28T21:02:10Z
Lists: pgsql-hackers
On 27.01.2011 06:44, Fujii Masao wrote:
> +		XLByteToSeg(endptr, endlogid, endlogseg);
> <snip>
> +			/* Have we reached our stop position yet? */
> +			if (logid>  endlogid ||
> +				(logid == endlogid&&  logseg>= endlogseg))
> +				break;
>
> What I said in upthread is wrong. We should use XLByteToPrevSeg
> for endptr and check "logseg>  endlogseg". Otherwise, if endptr is
> not a boundary byte, endlogid/endlogseg indicates the last
> necessary WAL file, but it's not sent.

We should use XLByteToPrevSeg, but I believe >= is still correct. 
logid/logseg is the last WAL segment we've successfully sent, and 
endlogif/endlogid is the last WAL segment we need to send. When they are 
the same, we're done.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com