Skip to content

Commit 2154e1c

Browse files
committed
TablespaceCreateDbspace should function normally even on platforms that do not
have symlinks (ie, Windows). Although it'll never be called on to do anything useful during normal operation on such a platform, it's still needed to re-create dropped directories during WAL replay.
1 parent 0a971e2 commit 2154e1c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/backend/commands/tablespace.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.32 2006/03/24 04:32:13 tgl Exp $
40+
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.33 2006/03/29 15:15:43 tgl Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -81,21 +81,21 @@ static void set_short_version(const char *path);
8181
* object in the tablespace, create the subdirectory. If the subdirectory
8282
* already exists, just fall through quietly.
8383
*
84-
* If tablespaces are not supported, this is just a no-op; CREATE DATABASE
85-
* is expected to create the default subdirectory for the database.
86-
*
8784
* isRedo indicates that we are creating an object during WAL replay.
8885
* In this case we will cope with the possibility of the tablespace
8986
* directory not being there either --- this could happen if we are
9087
* replaying an operation on a table in a subsequently-dropped tablespace.
9188
* We handle this by making a directory in the place where the tablespace
9289
* symlink would normally be. This isn't an exact replay of course, but
9390
* it's the best we can do given the available information.
91+
*
92+
* If tablespaces are not supported, you might think this could be a no-op,
93+
* but you'd be wrong: we still need it in case we have to re-create a
94+
* database subdirectory (of $PGDATA/base) during WAL replay.
9495
*/
9596
void
9697
TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo)
9798
{
98-
#ifdef HAVE_SYMLINK
9999
struct stat st;
100100
char *dir;
101101

@@ -178,7 +178,6 @@ TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo)
178178
}
179179

180180
pfree(dir);
181-
#endif /* HAVE_SYMLINK */
182181
}
183182

184183
/*

0 commit comments

Comments
 (0)