summaryrefslogtreecommitdiff
path: root/src/common/relpath.c
diff options
context:
space:
mode:
authorHeikki Linnakangas2024-03-03 17:38:22 +0000
committerHeikki Linnakangas2024-03-03 17:38:22 +0000
commit024c521117579a6d356050ad3d78fdc95e44eefa (patch)
tree27a2d9588eefc43c4bc3ac7b31f8a6740a2de34b /src/common/relpath.c
parentab355e3a88de745607f6dd4c21f0119b5c68f2ad (diff)
Replace BackendIds with 0-based ProcNumbers
Now that BackendId was just another index into the proc array, it was redundant with the 0-based proc numbers used in other places. Replace all usage of backend IDs with proc numbers. The only place where the term "backend id" remains is in a few pgstat functions that expose backend IDs at the SQL level. Those IDs are now in fact 0-based ProcNumbers too, but the documentation still calls them "backend ids". That term still seems appropriate to describe what the numbers are, so I let it be. One user-visible effect is that pg_temp_0 is now a valid temp schema name, for backend with ProcNumber 0. Reviewed-by: Andres Freund Discussion: https://www.postgresql.org/message-id/8171f1aa-496f-46a6-afc3-c46fe7a9b407@iki.fi
Diffstat (limited to 'src/common/relpath.c')
-rw-r--r--src/common/relpath.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/common/relpath.c b/src/common/relpath.c
index d9214f915c9..f54c36ef7ac 100644
--- a/src/common/relpath.c
+++ b/src/common/relpath.c
@@ -20,7 +20,7 @@
#include "catalog/pg_tablespace_d.h"
#include "common/relpath.h"
-#include "storage/backendid.h"
+#include "storage/procnumber.h"
/*
@@ -133,13 +133,13 @@ GetDatabasePath(Oid dbOid, Oid spcOid)
*
* Result is a palloc'd string.
*
- * Note: ideally, backendId would be declared as type BackendId, but relpath.h
- * would have to include a backend-only header to do that; doesn't seem worth
- * the trouble considering BackendId is just int anyway.
+ * Note: ideally, procNumber would be declared as type ProcNumber, but
+ * relpath.h would have to include a backend-only header to do that; doesn't
+ * seem worth the trouble considering ProcNumber is just int anyway.
*/
char *
GetRelationPath(Oid dbOid, Oid spcOid, RelFileNumber relNumber,
- int backendId, ForkNumber forkNumber)
+ int procNumber, ForkNumber forkNumber)
{
char *path;
@@ -147,7 +147,7 @@ GetRelationPath(Oid dbOid, Oid spcOid, RelFileNumber relNumber,
{
/* Shared system relations live in {datadir}/global */
Assert(dbOid == 0);
- Assert(backendId == InvalidBackendId);
+ Assert(procNumber == INVALID_PROC_NUMBER);
if (forkNumber != MAIN_FORKNUM)
path = psprintf("global/%u_%s",
relNumber, forkNames[forkNumber]);
@@ -157,7 +157,7 @@ GetRelationPath(Oid dbOid, Oid spcOid, RelFileNumber relNumber,
else if (spcOid == DEFAULTTABLESPACE_OID)
{
/* The default tablespace is {datadir}/base */
- if (backendId == InvalidBackendId)
+ if (procNumber == INVALID_PROC_NUMBER)
{
if (forkNumber != MAIN_FORKNUM)
path = psprintf("base/%u/%u_%s",
@@ -171,17 +171,17 @@ GetRelationPath(Oid dbOid, Oid spcOid, RelFileNumber relNumber,
{
if (forkNumber != MAIN_FORKNUM)
path = psprintf("base/%u/t%d_%u_%s",
- dbOid, backendId, relNumber,
+ dbOid, procNumber, relNumber,
forkNames[forkNumber]);
else
path = psprintf("base/%u/t%d_%u",
- dbOid, backendId, relNumber);
+ dbOid, procNumber, relNumber);
}
}
else
{
/* All other tablespaces are accessed via symlinks */
- if (backendId == InvalidBackendId)
+ if (procNumber == INVALID_PROC_NUMBER)
{
if (forkNumber != MAIN_FORKNUM)
path = psprintf("pg_tblspc/%u/%s/%u/%u_%s",
@@ -198,12 +198,12 @@ GetRelationPath(Oid dbOid, Oid spcOid, RelFileNumber relNumber,
if (forkNumber != MAIN_FORKNUM)
path = psprintf("pg_tblspc/%u/%s/%u/t%d_%u_%s",
spcOid, TABLESPACE_VERSION_DIRECTORY,
- dbOid, backendId, relNumber,
+ dbOid, procNumber, relNumber,
forkNames[forkNumber]);
else
path = psprintf("pg_tblspc/%u/%s/%u/t%d_%u",
spcOid, TABLESPACE_VERSION_DIRECTORY,
- dbOid, backendId, relNumber);
+ dbOid, procNumber, relNumber);
}
}
return path;