Skip to content

Commit 2281704

Browse files
committed
Please tablespace directories in their own subdirectory so pg_migrator
can upgrade clusters without renaming the tablespace directories. New directory structure format is, e.g.: $PGDATA/pg_tblspc/20981/PG_8.5_201001061/719849/83292814
1 parent 894fc6b commit 2281704

File tree

9 files changed

+189
-184
lines changed

9 files changed

+189
-184
lines changed

src/backend/catalog/catalog.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.86 2010/01/06 02:41:37 momjian Exp $
13+
* $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.87 2010/01/12 02:42:51 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -115,16 +115,17 @@ relpath(RelFileNode rnode, ForkNumber forknum)
115115
else
116116
{
117117
/* All other tablespaces are accessed via symlinks */
118-
pathlen = 10 + OIDCHARS + 1 + OIDCHARS + 1 + OIDCHARS + 1
119-
+ FORKNAMECHARS + 1;
118+
pathlen = 9 + 1 + OIDCHARS + 1 + strlen(TABLESPACE_VERSION_DIRECTORY) +
119+
1 + OIDCHARS + 1 + OIDCHARS + 1 + FORKNAMECHARS + 1;
120120
path = (char *) palloc(pathlen);
121121
if (forknum != MAIN_FORKNUM)
122-
snprintf(path, pathlen, "pg_tblspc/%u/%u/%u_%s",
123-
rnode.spcNode, rnode.dbNode, rnode.relNode,
124-
forkNames[forknum]);
122+
snprintf(path, pathlen, "pg_tblspc/%u/%s/%u/%u_%s",
123+
rnode.spcNode, TABLESPACE_VERSION_DIRECTORY,
124+
rnode.dbNode, rnode.relNode, forkNames[forknum]);
125125
else
126-
snprintf(path, pathlen, "pg_tblspc/%u/%u/%u",
127-
rnode.spcNode, rnode.dbNode, rnode.relNode);
126+
snprintf(path, pathlen, "pg_tblspc/%u/%s/%u/%u",
127+
rnode.spcNode, TABLESPACE_VERSION_DIRECTORY,
128+
rnode.dbNode, rnode.relNode);
128129
}
129130
return path;
130131
}
@@ -161,10 +162,11 @@ GetDatabasePath(Oid dbNode, Oid spcNode)
161162
else
162163
{
163164
/* All other tablespaces are accessed via symlinks */
164-
pathlen = 10 + OIDCHARS + 1 + OIDCHARS + 1;
165+
pathlen = 9 + 1 + OIDCHARS + 1 + strlen(TABLESPACE_VERSION_DIRECTORY) +
166+
1 + OIDCHARS + 1;
165167
path = (char *) palloc(pathlen);
166-
snprintf(path, pathlen, "pg_tblspc/%u/%u",
167-
spcNode, dbNode);
168+
snprintf(path, pathlen, "pg_tblspc/%u/%s/%u",
169+
spcNode, TABLESPACE_VERSION_DIRECTORY, dbNode);
168170
}
169171
return path;
170172
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy