1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

Add some code to CREATE DATABASE to check for pre-existing subdirectories

that conflict with the OID that we want to use for the new database.
This avoids the risk of trying to remove files that maybe we shouldn't
remove.  Per gripe from Jon Lapham and subsequent discussion of 27-Sep.
This commit is contained in:
Tom Lane
2006-10-18 22:44:12 +00:00
parent 877f08da14
commit 1e758d5263
2 changed files with 80 additions and 8 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.251 2006/10/06 17:13:58 petere Exp $
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.252 2006/10/18 22:44:11 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -5807,6 +5807,16 @@ XLogPutNextOid(Oid nextOid)
* record. Therefore, the standard buffer LSN interlock applied to those
* records will ensure no such OID reaches disk before the NEXTOID record
* does.
*
* Note, however, that the above statement only covers state "within" the
* database. When we use a generated OID as a file or directory name,
* we are in a sense violating the basic WAL rule, because that filesystem
* change may reach disk before the NEXTOID WAL record does. The impact
* of this is that if a database crash occurs immediately afterward,
* we might after restart re-generate the same OID and find that it
* conflicts with the leftover file or directory. But since for safety's
* sake we always loop until finding a nonconflicting filename, this poses
* no real problem in practice. See pgsql-hackers discussion 27-Sep-2006.
*/
}