/pgpatches/tablespace_replay_fix
text/x-diff
Filename: /pgpatches/tablespace_replay_fix
Type: text/x-diff
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
| File | + | − |
|---|---|---|
| src/backend/commands/tablespace.c | 18 | 4 |
Index: src/backend/commands/tablespace.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/commands/tablespace.c,v
retrieving revision 1.77
diff -c -c -r1.77 tablespace.c
*** src/backend/commands/tablespace.c 18 Jul 2010 04:47:46 -0000 1.77
--- src/backend/commands/tablespace.c 18 Jul 2010 15:53:34 -0000
***************
*** 568,578 ****
*/
if (mkdir(location_with_version_dir, S_IRWXU) < 0)
{
if (errno == EEXIST)
! ereport(ERROR,
! (errcode(ERRCODE_OBJECT_IN_USE),
! errmsg("directory \"%s\" already in use as a tablespace",
! location_with_version_dir)));
else
ereport(ERROR,
(errcode_for_file_access(),
--- 568,582 ----
*/
if (mkdir(location_with_version_dir, S_IRWXU) < 0)
{
+ /* In recovery, directory might already exists, which is OK */
if (errno == EEXIST)
! {
! if (!InRecovery)
! ereport(ERROR,
! (errcode(ERRCODE_OBJECT_IN_USE),
! errmsg("directory \"%s\" already in use as a tablespace",
! location_with_version_dir)));
! }
else
ereport(ERROR,
(errcode_for_file_access(),
***************
*** 580,585 ****
--- 584,599 ----
location_with_version_dir)));
}
+ /* Remove old symlink in recovery, in case it points to the wrong place */
+ if (InRecovery)
+ {
+ if (unlink(linkloc) < 0 && errno != ENOENT)
+ ereport(ERROR,
+ (errcode_for_file_access(),
+ errmsg("could not remove symbolic link \"%s\": %m",
+ linkloc)));
+ }
+
/*
* Create the symlink under PGDATA
*/