postgresql/src
Michael Paquier a7eadaaaaf Fix pg_rewind when rewinding new database with tables included
This fixes an issue introduced by 266b6ac, which has added filters to
exclude file patterns on the target and source data directories to
reduce the number of files transferred.  Filters get applied to both
the target and source data files, and include pg_internal.init which is
present for each database once relations are created on it.  However, if
the target differed from the source with at least one new database with
relations, the rewind would fail due to the exclusion filters applied on
the target files, causing pg_internal.init to still be present on the
target database folder, while its contents should have been completely
removed so as there is nothing remaining inside at the time of the
folder deletion.

Applying exclusion filters on the source files is fine, because this way
the amount of data copied from the source to the target is reduced.  And
actually, not applying the filters on the target is what pg_rewind
should do, because this causes such files to be automatically removed
during the rewind on the target.  Exclusion filters apply to paths which
are removed or recreated automatically at startup, so removing all those
files on the target during the rewind is a win.

The existing set of TAP tests already stresses the rewind of databases,
but it did not include any tables on those newly-created databases.
Creating extra tables in this case is enough to reproduce the failure,
so the existing tests are extended to close the gap.

Reported-by: Mithun Cy
Author: Michael Paquier
Discussion: https://postgr.es/m/CADq3xVYt6_pO7ZzmjOqPgY9HWsL=kLd-_tNyMtdfjKqEALDyTA@mail.gmail.com
Backpatch-through: 11
2019-03-18 10:34:45 +09:00
..
backend Beautify initialization of JsonValueList and JsonLikeRegexContext 2019-03-17 12:58:26 +03:00
bin Fix pg_rewind when rewinding new database with tables included 2019-03-18 10:34:45 +09:00
common Add routine able to update the control file to src/common/ 2019-03-12 10:03:33 +09:00
fe_utils More unconstify use 2019-02-13 11:50:16 +01:00
include Fix make rules for jsonpath grammar making them similar to SQL grammar 2019-03-17 10:55:52 +03:00
interfaces Use correct connection name variable in ecpglib. 2019-03-16 04:01:06 +01:00
makefiles Move port-specific parts of with_temp_install to port makefile. 2019-02-04 18:54:56 +00:00
pl PL/Tcl: Improve trigger tests organization 2019-03-15 12:42:07 +01:00
port Fix error handling of readdir() port implementation on first file lookup 2019-03-04 09:49:06 +09:00
template Yet further rethinking of build changes for macOS Mojave. 2018-11-02 18:54:00 -04:00
test Add support for collation attributes on older ICU versions 2019-03-17 08:47:15 +01:00
timezone More unconstify use 2019-02-13 11:50:16 +01:00
tools Partial implementation of SQL/JSON path language 2019-03-16 12:16:48 +03:00
tutorial SQL comment: remove extra word in heading comment 2019-01-25 18:57:21 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Revert attempts to use POPCNT etc instructions 2019-02-15 16:32:30 -03:00
Makefile.shlib Ensure static libraries have correct mod time even if ranlib messes it up. 2018-11-29 15:53:44 -05:00
nls-global.mk Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00