diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-10-18 22:44:12 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-10-18 22:44:12 +0000 |
commit | 1e758d5263e54a5d79ef368473e7e70d009944de (patch) | |
tree | 676c78bf6f5a69526e1990fb42c09a80e542ba69 /src/backend/access/transam/xlog.c | |
parent | 877f08da14719a1bead6154785ab45714d347998 (diff) | |
download | postgresql-1e758d5263e54a5d79ef368473e7e70d009944de.tar.gz postgresql-1e758d5263e54a5d79ef368473e7e70d009944de.zip |
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.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index b0556034aeb..ba029397f87 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -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. */ } |