]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Prevent archive recovery from scanning non-existent WAL files.
authorFujii Masao <fujii@postgresql.org>
Tue, 7 Apr 2020 15:49:29 +0000 (00:49 +0900)
committerFujii Masao <fujii@postgresql.org>
Sat, 9 May 2020 03:04:51 +0000 (12:04 +0900)
commitdcd1569fb05df2e4180657149cfe2965222c32ca
tree4ce594c2a57df74d097747cbab98b2703ebc2fd9
parent7b540f8707b716181f2b0d3db68e92868d09d867
Prevent archive recovery from scanning non-existent WAL files.

Previously when there were multiple timelines listed in the history file
of the recovery target timeline, archive recovery searched all of them,
starting from the newest timeline to the oldest one, to find the segment
to read. That is, archive recovery had to continuously fail scanning
the segment until it reached the timeline that the segment belonged to.
These scans for non-existent segment could be harmful on the recovery
performance especially when archival area was located on the remote
storage and each scan could take a long time.

To address the issue, this commit changes archive recovery so that
it skips scanning the timeline that the segment to read doesn't belong to.

Per discussion, back-patch to all supported versions.

Author: Kyotaro Horiguchi, tweaked a bit by Fujii Masao
Reviewed-by: David Steele, Pavel Suderevsky, Grigory Smolkin
Discussion: https://postgr.es/m/16159-f5a34a3a04dc67e0@postgresql.org
Discussion: https://postgr.es/m/20200129.120222.1476610231001551715.horikyota.ntt@gmail.com
src/backend/access/transam/xlog.c