aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2014-10-20 23:43:46 +0200
committerAndres Freund <andres@anarazel.de>2014-10-20 23:43:46 +0200
commit7dbb60693820c20b562c12f58040c9871d6ab787 (patch)
tree2acdf8ba1660906f170dae3641cd9540d46fdec0 /src/backend/access/transam/xlog.c
parent83dc5908c207bc0ff4256eb862f6a211ad5596ec (diff)
downloadpostgresql-7dbb60693820c20b562c12f58040c9871d6ab787.tar.gz
postgresql-7dbb60693820c20b562c12f58040c9871d6ab787.zip
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.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 235b4422969..a9df3a5806d 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7771,9 +7771,9 @@ LogCheckpointStart(int flags, bool restartpoint)
* the main message, but what about all the flags?
*/
if (restartpoint)
- msg = "restartpoint starting:%s%s%s%s%s%s%s";
+ msg = "restartpoint starting:%s%s%s%s%s%s%s%s";
else
- msg = "checkpoint starting:%s%s%s%s%s%s%s";
+ msg = "checkpoint starting:%s%s%s%s%s%s%s%s";
elog(LOG, msg,
(flags & CHECKPOINT_IS_SHUTDOWN) ? " shutdown" : "",
@@ -7782,7 +7782,8 @@ LogCheckpointStart(int flags, bool restartpoint)
(flags & CHECKPOINT_FORCE) ? " force" : "",
(flags & CHECKPOINT_WAIT) ? " wait" : "",
(flags & CHECKPOINT_CAUSE_XLOG) ? " xlog" : "",
- (flags & CHECKPOINT_CAUSE_TIME) ? " time" : "");
+ (flags & CHECKPOINT_CAUSE_TIME) ? " time" : "",
+ (flags & CHECKPOINT_FLUSH_ALL) ? " flush-all" :"");
}
/*