summaryrefslogtreecommitdiff
path: root/src/backend/commands/tablespace.c
diff options
context:
space:
mode:
authorBruce Momjian2010-01-07 04:05:39 +0000
committerBruce Momjian2010-01-07 04:05:39 +0000
commit85fcbd865503689463399d7f5bb6d95eb49aea12 (patch)
tree16b60604bec0dbcc3af530f3ed615553e7f5f913 /src/backend/commands/tablespace.c
parent814c8a03bacf9e30c2c7b4e652986b68a292ac30 (diff)
Clarify tablespace.c::TablespaceCreateDbspace() comments.
Diffstat (limited to 'src/backend/commands/tablespace.c')
-rw-r--r--src/backend/commands/tablespace.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 5c6767d6138..08a54ebec16 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.68 2010/01/06 23:23:51 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.69 2010/01/07 04:05:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -89,7 +89,7 @@ static void write_version_file(const char *path);
* Each database using a table space is isolated into its own name space
* by a subdirectory named for the database OID. On first creation of an
* object in the tablespace, create the subdirectory. If the subdirectory
- * already exists, just fall through quietly.
+ * already exists, fall through quietly.
*
* isRedo indicates that we are creating an object during WAL replay.
* In this case we will cope with the possibility of the tablespace
@@ -137,29 +137,32 @@ TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo)
*/
if (stat(dir, &st) == 0 && S_ISDIR(st.st_mode))
{
- /* need not do anything */
+ /* Directory was created. */
}
else
{
- /* OK, go for it */
+ /* Directory creation failed? */
if (mkdir(dir, S_IRWXU) < 0)
{
char *parentdir;
+ /* Failure other than not exists? */
if (errno != ENOENT || !isRedo)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not create directory \"%s\": %m",
dir)));
- /* Try to make parent directory too */
+ /* Parent directory must be missing */
parentdir = pstrdup(dir);
get_parent_directory(parentdir);
+ /* Can't create parent either? */
if (mkdir(parentdir, S_IRWXU) < 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not create directory \"%s\": %m",
parentdir)));
pfree(parentdir);
+ /* Create database directory */
if (mkdir(dir, S_IRWXU) < 0)
ereport(ERROR,
(errcode_for_file_access(),
@@ -179,7 +182,7 @@ TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo)
}
else
{
- /* be paranoid */
+ /* Is it not a directory? */
if (!S_ISDIR(st.st_mode))
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),