pgsql: Fix two timeline handling bugs in pg_receivexlog.

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема pgsql: Fix two timeline handling bugs in pg_receivexlog.
Дата
Msg-id E1VO0ln-0001se-1Y@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix two timeline handling bugs in pg_receivexlog.

When a timeline history file is fetched from server, it is initially created
with a temporary file name, and renamed to place. However, the temporary
file name was constructed using an uninitialized buffer. Usually that meant
that the file was created in current directory instead of the target, which
usually goes unnoticed, but if the target is on a different filesystem than
the current dir, the rename() would fail. Fix that.

The second issue is that pg_receivexlog would not take .partial files into
account when determining when scanning the target directory for existing
WAL files. If the timeline has switched in the server several times in the
last WAL segment, and pg_receivexlog is restarted, it would choose a too
old starting point. That's not a problem as long as the old WAL segment
exists in the server and can be streamed over, but will cause a failure if
it's not.

Backpatch to 9.3, where this timeline handling code was written.

Analysed by Andrew Gierth, bug #8453, based on a bug report on IRC.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/62ff6556ab588a05259b33bd1a9d663fad96648b

Modified Files
--------------
src/bin/pg_basebackup/pg_receivexlog.c |   74 +++++++++++++++++++++-----------
src/bin/pg_basebackup/receivelog.c     |    7 ++-
2 files changed, 52 insertions(+), 29 deletions(-)


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: pgsql: Fix compiler warning in WaitForBackgroundWorkerStartup().
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: pgsql: Fix two timeline handling bugs in pg_receivexlog.