]> granicus.if.org Git - postgresql/commit
Avoid bogus "out-of-sequence timeline ID" errors in standby-mode.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 22 Nov 2012 09:23:46 +0000 (11:23 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 22 Nov 2012 09:44:44 +0000 (11:44 +0200)
commit24c19e6bf96d556b3a9517ce42f54b5756ca0384
tree6598a0bd4b985171bc7122ea1afb37e14cdda5b6
parent27b2c6a1ef8ab5993e2aed4366d2c49c8989381a
Avoid bogus "out-of-sequence timeline ID" errors in standby-mode.

When startup process opens a WAL segment after replaying part of it, it
validates the first page on the WAL segment, even though the page it's
really interested in later in the file. As part of the validation, it checks
that the TLI on the page header is >= the TLI it saw on the last page it
read. If the segment contains a timeline switch, and we have already
replayed it, and then re-open the WAL segment (because of streaming
replication got disconnected and reconnected, for example), the TLI check
will fail when the first page is validated. Fix that by relaxing the TLI
check when re-opening a WAL segment.

Backpatch to 9.0. Earlier versions had the same code, but before standby
mode was introduced in 9.0, recovery never tried to re-read a segment after
partially replaying it.

Reported by Amit Kapila, while testing a new feature.
src/backend/access/transam/xlog.c