Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a3cac3a

Browse files
committed
Need to do BufferSync at end of DROP DATABASE as well as CREATE DATABASE.
Otherwise, newly connecting backends will still think the deleted DB is valid, and will generate unexpected error messages.
1 parent c0f0699 commit a3cac3a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/backend/commands/dbcommands.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.70 2000/11/30 08:46:22 vadim Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.71 2001/01/14 22:14:10 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -153,7 +153,8 @@ createdb(const char *dbname, const char *dbpath,
153153
elog(ERROR, "database path may not contain single quotes");
154154
/* ... otherwise we'd be open to shell exploits below */
155155

156-
/* Force dirty buffers out to disk, to ensure source database is
156+
/*
157+
* Force dirty buffers out to disk, to ensure source database is
157158
* up-to-date for the copy. (We really only need to flush buffers
158159
* for the source database...)
159160
*/
@@ -253,7 +254,8 @@ createdb(const char *dbname, const char *dbpath,
253254
/* Close pg_database, but keep lock till commit */
254255
heap_close(pg_database_rel, NoLock);
255256

256-
/* Force dirty buffers out to disk, so that newly-connecting backends
257+
/*
258+
* Force dirty buffers out to disk, so that newly-connecting backends
257259
* will see the new database in pg_database right away. (They'll see
258260
* an uncommitted tuple, but they don't care; see GetRawDatabaseInfo.)
259261
*/
@@ -369,6 +371,14 @@ dropdb(const char *dbname)
369371
* Remove the database's subdirectory and everything in it.
370372
*/
371373
remove_dbdirs(nominal_loc, alt_loc);
374+
375+
/*
376+
* Force dirty buffers out to disk, so that newly-connecting backends
377+
* will see the database tuple marked dead in pg_database right away.
378+
* (They'll see an uncommitted deletion, but they don't care; see
379+
* GetRawDatabaseInfo.)
380+
*/
381+
BufferSync();
372382
}
373383

374384

0 commit comments

Comments
 (0)