]> granicus.if.org Git - postgresql/commit
Change the order that pg_xlog and WAL archive are polled for WAL segments.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 14 Feb 2014 13:15:09 +0000 (15:15 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 14 Feb 2014 13:15:09 +0000 (15:15 +0200)
commit4d894b41cd12179b710526eba9dc62c2b99abc4d
treeddd3c1c83bfa2bcb8164fcba6ee5e9c4bcccfd18
parent0f2ca0075c4bd42351cd48b3e6889f11f0e03e65
Change the order that pg_xlog and WAL archive are polled for WAL segments.

If there is a WAL segment with same ID but different TLI present in both
the WAL archive and pg_xlog, prefer the one with higher TLI. Before this
patch, the archive was polled first, for all expected TLIs, and only if no
file was found was pg_xlog scanned. This was a change in behavior from 9.3,
which first scanned archive and pg_xlog for the highest TLI, then archive
and pg_xlog for the next highest TLI and so forth. This patch reverts the
behavior back to what it was in 9.2.

The reason for this is that if for example you try to do archive recovery
to timeline 2, which branched off timeline 1, but the WAL for timeline 2 is
not archived yet, we would replay past the timeline switch point on
timeline 1 using the archived files, before even looking timeline 2's files
in pg_xlog

Report and patch by Kyotaro Horiguchi. Backpatch to 9.3 where the behavior
was changed.
src/backend/access/transam/xlog.c