pgsql: Fix pg_rewind when rewinding new database with tables included

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема pgsql: Fix pg_rewind when rewinding new database with tables included
Дата
Msg-id E1h5hC8-0000hd-Mw@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a7eadaaaaf089994279488f795bdedd9ded1682a

Modified Files
--------------
src/bin/pg_rewind/filemap.c          | 13 +++++++------
src/bin/pg_rewind/t/002_databases.pl | 12 ++++++++++--
src/bin/pg_rewind/t/RewindTest.pm    |  6 ++++--
3 files changed, 21 insertions(+), 10 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: pgsql: Error out in pg_checksums on incompatible block size
Следующее
От: Michael Paquier
Дата:
Сообщение: pgsql: Refactor more code logic to update the control file