aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/dbcommands.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-10-28 00:39:59 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-10-28 00:39:59 +0000
commite6f9bf9b7fce69d491cefd388a5004448bd38073 (patch)
tree2d1294d1c3aced63a96465f9b9966e9ff870d8c6 /src/backend/commands/dbcommands.c
parenta7049b52e3137cfebfb3d73d8779a9094809d52a (diff)
downloadpostgresql-e6f9bf9b7fce69d491cefd388a5004448bd38073.tar.gz
postgresql-e6f9bf9b7fce69d491cefd388a5004448bd38073.zip
On Windows, force a checkpoint just before dropping a database's physical
files and directories. This ensures that the bgwriter will close any open file references it is holding for files therein, which is needed for the rmdir() to succeed. Andrew Dunstan and Tom Lane.
Diffstat (limited to 'src/backend/commands/dbcommands.c')
-rw-r--r--src/backend/commands/dbcommands.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 917429c2b52..a74ad9b2f07 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.145 2004/10/17 20:47:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.146 2004/10/28 00:39:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,6 +32,7 @@
#include "commands/tablespace.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
+#include "postmaster/bgwriter.h"
#include "storage/fd.h"
#include "storage/freespace.h"
#include "storage/sinval.h"
@@ -625,6 +626,14 @@ dropdb(const char *dbname)
FreeSpaceMapForgetDatabase(db_id);
/*
+ * On Windows, force a checkpoint so that the bgwriter doesn't hold any
+ * open files, which would cause rmdir() to fail.
+ */
+#ifdef WIN32
+ RequestCheckpoint(true);
+#endif
+
+ /*
* Remove all tablespace subdirs belonging to the database.
*/
remove_dbtablespaces(db_id);