pgsql: Flush unlogged table's buffers when copying or moving databases.

Поиск
Список
Период
Сортировка
От Andres Freund
Тема pgsql: Flush unlogged table's buffers when copying or moving databases.
Дата
Msg-id E1XgKyw-00021p-8h@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Flush unlogged table's buffers when copying or moving databases.

CREATE DATABASE and ALTER DATABASE .. SET TABLESPACE copy the source
database directory on the filesystem level. To ensure the on disk
state is consistent they block out users of the affected database and
force a checkpoint to flush out all data to disk. Unfortunately, up to
now, that checkpoint didn't flush out dirty buffers from unlogged
relations.

That bug means there could be leftover dirty buffers in either the
template database, or the database in its old location. Leading to
problems when accessing relations in an inconsistent state; and to
possible problems during shutdown in the SET TABLESPACE case because
buffers belonging files that don't exist anymore are flushed.

This was reported in bug #10675 by Maxim Boguk.

Fix by Pavan Deolasee, modified somewhat by me. Reviewed by MauMau and
Fujii Masao.

Backpatch to 9.1 where unlogged tables were introduced.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/5607e996f4ba93a4c56ea94f10d1fcc876b4bf42

Modified Files
--------------
src/backend/access/transam/xlog.c   |    7 ++++---
src/backend/commands/dbcommands.c   |   26 +++++++++++++++-----------
src/backend/storage/buffer/bufmgr.c |   16 +++++++++-------
src/include/access/xlog.h           |    2 ++
4 files changed, 30 insertions(+), 21 deletions(-)


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: pg_test_fsync: Update output format
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: Flush unlogged table's buffers when copying or moving databases.