postgresql/src
Michael Paquier a6fc64b9a8 Fix race in TAP test 002_archiving.pl when restoring history file
This test, introduced in df86e52, uses a second standby to check that
it is able to remove correctly RECOVERYHISTORY and RECOVERYXLOG at the
end of recovery.  This standby uses the archives of the primary to
restore its contents, with some of the archive's contents coming from
the first standby previously promoted.  In slow environments, it was
possible that the test did not check what it should, as the history file
generated by the promotion of the first standby may not be stored yet on
the archives the second standby feeds on.  So, it could be possible that
the second standby selects an incorrect timeline, without restoring a
history file at all.

This commits adds a wait phase to make sure that the history file
required by the second standby is archived before this cluster is
created.  This relies on poll_query_until() with pg_stat_file() and an
absolute path, something not supported in REL_10_STABLE.

While on it, this adds a new test to check that the history file has
been restored by looking at the logs of the second standby.  This
ensures that a RECOVERYHISTORY, whose removal needs to be checked,
is created in the first place.  This should make the test more robust.

This test has been introduced by df86e52, but it came in light as an
effect of the bug fixed by acf1dd42, where the extra restore_command
calls made the test much slower.

Reported-by: Andres Freund
Discussion: https://postgr.es/m/YlT23IvsXkGuLzFi@paquier.xyz
Backpatch-through: 11
2022-04-18 11:40:18 +09:00
..
backend Rethink the delay-checkpoint-end mechanism in the back-branches. 2022-04-14 11:10:11 -04:00
bin waldump: fix use-after-free in search_directory(). 2022-03-27 18:15:14 -07:00
common Fix buffer overrun in unicode string normalization with empty input 2021-11-11 15:01:54 +09:00
fe_utils Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
include Rethink the delay-checkpoint-end mechanism in the back-branches. 2022-04-14 11:10:11 -04:00
interfaces Add a temp-install prerequisite to src/interfaces/ecpg "checktcp". 2022-04-16 17:43:57 -07:00
makefiles Remove libpq.rc, use win32ver.rc for libpq 2020-01-15 15:06:12 +01:00
pl Disallow execution of SPI functions during plperl function compilation. 2022-02-25 17:40:44 -05:00
port AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS. 2021-09-06 11:28:02 -07:00
template Further tweaking of PG_SYSROOT heuristics for macOS. 2021-01-20 12:07:31 -05:00
test Fix race in TAP test 002_archiving.pl when restoring history file 2022-04-18 11:40:18 +09:00
timezone Update time zone data files to tzdata release 2021e. 2021-10-29 11:38:38 -04:00
tools Revert "Fix replay of create database records on standby" 2022-03-29 15:36:21 +02:00
tutorial tutorial: land height is "elevation", not "altitude" 2021-03-10 20:25:18 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Fix prove_installcheck to use correct paths when used with PGXS 2021-07-01 08:46:38 -04:00
Makefile.shlib AIX: Fix missing libpq symbols by respecting SHLIB_EXPORTS. 2021-09-06 11:28:02 -07:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:04:20 +02:00