Skip to content

Commit aa21da2

Browse files
committed
Put back BufferSync() for WAL after database creation.
Also, add some comments about what it's for...
1 parent 52aa720 commit aa21da2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/backend/commands/dbcommands.c

Lines changed: 13 additions & 2 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.68 2000/11/16 22:30:18 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.69 2000/11/18 03:36:48 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -154,7 +154,10 @@ createdb(const char *dbname, const char *dbpath,
154154
/* ... otherwise we'd be open to shell exploits below */
155155

156156
#ifdef XLOG
157-
/* Try to force any dirty buffers out to disk */
157+
/* Force dirty buffers out to disk, to ensure source database is
158+
* up-to-date for the copy. (We really only need to flush buffers
159+
* for the source database...)
160+
*/
158161
BufferSync();
159162
#endif
160163

@@ -251,6 +254,14 @@ createdb(const char *dbname, const char *dbpath,
251254

252255
/* Close pg_database, but keep lock till commit */
253256
heap_close(pg_database_rel, NoLock);
257+
258+
#ifdef XLOG
259+
/* Force dirty buffers out to disk, so that newly-connecting backends
260+
* will see the new database in pg_database right away. (They'll see
261+
* an uncommitted tuple, but they don't care; see GetRawDatabaseInfo.)
262+
*/
263+
BufferSync();
264+
#endif
254265
}
255266

256267

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy