From 76668e6eb468caa6e09af71d6bee820e2dc0fc3c Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 2 May 2005 18:26:54 +0000 Subject: Check the file system on postmaster startup and report any unreferenced files in the server log. Heikki Linnakangas --- src/backend/commands/tablespace.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/backend/commands') diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index 9a18fd6e839..be0cc555940 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.17 2005/04/14 20:03:24 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.18 2005/05/02 18:26:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -341,8 +341,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt) /* * All seems well, create the symlink */ - linkloc = (char *) palloc(strlen(DataDir) + 11 + 10 + 1); - sprintf(linkloc, "%s/pg_tblspc/%u", DataDir, tablespaceoid); + linkloc = GetTablespacePath(tablespaceoid); if (symlink(location, linkloc) < 0) ereport(ERROR, @@ -495,8 +494,7 @@ remove_tablespace_directories(Oid tablespaceoid, bool redo) char *subfile; struct stat st; - location = (char *) palloc(strlen(DataDir) + 11 + 10 + 1); - sprintf(location, "%s/pg_tblspc/%u", DataDir, tablespaceoid); + location = GetTablespacePath(tablespaceoid); /* * Check if the tablespace still contains any files. We try to rmdir @@ -1036,8 +1034,7 @@ tblspc_redo(XLogRecPtr lsn, XLogRecord *record) set_short_version(location); /* Create the symlink if not already present */ - linkloc = (char *) palloc(strlen(DataDir) + 11 + 10 + 1); - sprintf(linkloc, "%s/pg_tblspc/%u", DataDir, xlrec->ts_id); + linkloc = GetTablespacePath(xlrec->ts_id); if (symlink(location, linkloc) < 0) { -- cgit v1.2.3