pgsql: Don't archive bogus recycled or preallocated files after timelin

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема pgsql: Don't archive bogus recycled or preallocated files after timelin
Дата
Msg-id E1YhfnC-0004X8-RF@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Don't archive bogus recycled or preallocated files after timeline switch.

After a timeline switch, we would leave behind recycled WAL segments that
are in the future, but on the old timeline. After promotion, and after they
become old enough to be recycled again, we would notice that they don't have
a .ready or .done file, create a .ready file for them, and archive them.
That's bogus, because the files contain garbage, recycled from an older
timeline (or prealloced as zeros). We shouldn't archive such files.

This could happen when we're following a timeline switch during replay, or
when we switch to new timeline at end-of-recovery.

To fix, whenever we switch to a new timeline, scan the data directory for
WAL segments on the old timeline, but with a higher segment number, and
remove them. Those don't belong to our timeline history, and are most
likely bogus recycled or preallocated files. They could also be valid files
that we streamed from the primary ahead of time, but in any case, they're
not needed to recover to the new timeline.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/d72792d0213ec352cdb71f3994a53194bc00f220

Modified Files
--------------
src/backend/access/transam/xlog.c        |  283 ++++++++++++++++++++----------
src/backend/access/transam/xlogarchive.c |   19 ++
src/include/access/xlog_internal.h       |    1 +
3 files changed, 209 insertions(+), 94 deletions(-)


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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: pgsql: Don't archive bogus recycled or preallocated files after timelin
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: pgsql: Don't archive bogus recycled or preallocated files after timelin