aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/dbcommands.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-06-28 00:02:40 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-06-28 00:02:40 +0000
commit867e2c91a0c341111b7a5257dc4c9a2659a022dc (patch)
tree088aa81d027903d3293e8a7d978801678f8a403a /src/backend/commands/dbcommands.c
parentb09c248bdd3d0d86714865d2142604aea789e840 (diff)
downloadpostgresql-867e2c91a0c341111b7a5257dc4c9a2659a022dc.tar.gz
postgresql-867e2c91a0c341111b7a5257dc4c9a2659a022dc.zip
Implement "distributed" checkpoints in which the checkpoint I/O is spread
over a fairly long period of time, rather than being spat out in a burst. This happens only for background checkpoints carried out by the bgwriter; other cases, such as a shutdown checkpoint, are still done at full speed. Remove the "all buffers" scan in the bgwriter, and associated stats infrastructure, since this seems no longer very useful when the checkpoint itself is properly throttled. Original patch by Itagaki Takahiro, reworked by Heikki Linnakangas, and some minor API editorialization by me.
Diffstat (limited to 'src/backend/commands/dbcommands.c')
-rw-r--r--src/backend/commands/dbcommands.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index e99ab5d200f..4ceb962fb95 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.195 2007/06/01 19:38:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.196 2007/06/28 00:02:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -401,10 +401,9 @@ createdb(const CreatedbStmt *stmt)
/*
* Force dirty buffers out to disk, to ensure source database is
- * up-to-date for the copy. (We really only need to flush buffers for the
- * source database, but bufmgr.c provides no API for that.)
+ * up-to-date for the copy.
*/
- BufferSync();
+ FlushDatabaseBuffers(src_dboid);
/*
* Once we start copying subdirectories, we need to be able to clean 'em
@@ -507,7 +506,7 @@ createdb(const CreatedbStmt *stmt)
* Perhaps if we ever implement CREATE DATABASE in a less cheesy way,
* we can avoid this.
*/
- RequestCheckpoint(true, false);
+ RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
/*
* Close pg_database, but keep lock till commit (this is important to
@@ -661,7 +660,7 @@ dropdb(const char *dbname, bool missing_ok)
* open files, which would cause rmdir() to fail.
*/
#ifdef WIN32
- RequestCheckpoint(true, false);
+ RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
#endif
/*
@@ -1424,10 +1423,9 @@ dbase_redo(XLogRecPtr lsn, XLogRecord *record)
/*
* Force dirty buffers out to disk, to ensure source database is
- * up-to-date for the copy. (We really only need to flush buffers for
- * the source database, but bufmgr.c provides no API for that.)
+ * up-to-date for the copy.
*/
- BufferSync();
+ FlushDatabaseBuffers(xlrec->src_db_id);
/*
* Copy this subdirectory to the new location