diff options
Diffstat (limited to 'src/backend/utils/adt/dbsize.c')
-rw-r--r-- | src/backend/utils/adt/dbsize.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index b4a2c8d2197..34efa121b40 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -27,7 +27,7 @@ #include "utils/builtins.h" #include "utils/numeric.h" #include "utils/rel.h" -#include "utils/relfilenodemap.h" +#include "utils/relfilenumbermap.h" #include "utils/relmapper.h" #include "utils/syscache.h" @@ -292,7 +292,7 @@ pg_tablespace_size_name(PG_FUNCTION_ARGS) * is no check here or at the call sites for that. */ static int64 -calculate_relation_size(RelFileNode *rfn, BackendId backend, ForkNumber forknum) +calculate_relation_size(RelFileLocator *rfn, BackendId backend, ForkNumber forknum) { int64 totalsize = 0; char *relationpath; @@ -349,7 +349,7 @@ pg_relation_size(PG_FUNCTION_ARGS) if (rel == NULL) PG_RETURN_NULL(); - size = calculate_relation_size(&(rel->rd_node), rel->rd_backend, + size = calculate_relation_size(&(rel->rd_locator), rel->rd_backend, forkname_to_number(text_to_cstring(forkName))); relation_close(rel, AccessShareLock); @@ -374,7 +374,7 @@ calculate_toast_table_size(Oid toastrelid) /* toast heap size, including FSM and VM size */ for (forkNum = 0; forkNum <= MAX_FORKNUM; forkNum++) - size += calculate_relation_size(&(toastRel->rd_node), + size += calculate_relation_size(&(toastRel->rd_locator), toastRel->rd_backend, forkNum); /* toast index size, including FSM and VM size */ @@ -388,7 +388,7 @@ calculate_toast_table_size(Oid toastrelid) toastIdxRel = relation_open(lfirst_oid(lc), AccessShareLock); for (forkNum = 0; forkNum <= MAX_FORKNUM; forkNum++) - size += calculate_relation_size(&(toastIdxRel->rd_node), + size += calculate_relation_size(&(toastIdxRel->rd_locator), toastIdxRel->rd_backend, forkNum); relation_close(toastIdxRel, AccessShareLock); @@ -417,7 +417,7 @@ calculate_table_size(Relation rel) * heap size, including FSM and VM */ for (forkNum = 0; forkNum <= MAX_FORKNUM; forkNum++) - size += calculate_relation_size(&(rel->rd_node), rel->rd_backend, + size += calculate_relation_size(&(rel->rd_locator), rel->rd_backend, forkNum); /* @@ -456,7 +456,7 @@ calculate_indexes_size(Relation rel) idxRel = relation_open(idxOid, AccessShareLock); for (forkNum = 0; forkNum <= MAX_FORKNUM; forkNum++) - size += calculate_relation_size(&(idxRel->rd_node), + size += calculate_relation_size(&(idxRel->rd_locator), idxRel->rd_backend, forkNum); @@ -850,7 +850,7 @@ Datum pg_relation_filenode(PG_FUNCTION_ARGS) { Oid relid = PG_GETARG_OID(0); - Oid result; + RelFileNumber result; HeapTuple tuple; Form_pg_class relform; @@ -864,29 +864,29 @@ pg_relation_filenode(PG_FUNCTION_ARGS) if (relform->relfilenode) result = relform->relfilenode; else /* Consult the relation mapper */ - result = RelationMapOidToFilenode(relid, - relform->relisshared); + result = RelationMapOidToFilenumber(relid, + relform->relisshared); } else { /* no storage, return NULL */ - result = InvalidOid; + result = InvalidRelFileNumber; } ReleaseSysCache(tuple); - if (!OidIsValid(result)) + if (!RelFileNumberIsValid(result)) PG_RETURN_NULL(); PG_RETURN_OID(result); } /* - * Get the relation via (reltablespace, relfilenode) + * Get the relation via (reltablespace, relfilenumber) * * This is expected to be used when somebody wants to match an individual file * on the filesystem back to its table. That's not trivially possible via - * pg_class, because that doesn't contain the relfilenodes of shared and nailed + * pg_class, because that doesn't contain the relfilenumbers of shared and nailed * tables. * * We don't fail but return NULL if we cannot find a mapping. @@ -898,14 +898,14 @@ Datum pg_filenode_relation(PG_FUNCTION_ARGS) { Oid reltablespace = PG_GETARG_OID(0); - Oid relfilenode = PG_GETARG_OID(1); + RelFileNumber relfilenumber = PG_GETARG_OID(1); Oid heaprel; - /* test needed so RelidByRelfilenode doesn't misbehave */ - if (!OidIsValid(relfilenode)) + /* test needed so RelidByRelfilenumber doesn't misbehave */ + if (!RelFileNumberIsValid(relfilenumber)) PG_RETURN_NULL(); - heaprel = RelidByRelfilenode(reltablespace, relfilenode); + heaprel = RelidByRelfilenumber(reltablespace, relfilenumber); if (!OidIsValid(heaprel)) PG_RETURN_NULL(); @@ -924,7 +924,7 @@ pg_relation_filepath(PG_FUNCTION_ARGS) Oid relid = PG_GETARG_OID(0); HeapTuple tuple; Form_pg_class relform; - RelFileNode rnode; + RelFileLocator rlocator; BackendId backend; char *path; @@ -937,29 +937,29 @@ pg_relation_filepath(PG_FUNCTION_ARGS) { /* This logic should match RelationInitPhysicalAddr */ if (relform->reltablespace) - rnode.spcNode = relform->reltablespace; + rlocator.spcOid = relform->reltablespace; else - rnode.spcNode = MyDatabaseTableSpace; - if (rnode.spcNode == GLOBALTABLESPACE_OID) - rnode.dbNode = InvalidOid; + rlocator.spcOid = MyDatabaseTableSpace; + if (rlocator.spcOid == GLOBALTABLESPACE_OID) + rlocator.dbOid = InvalidOid; else - rnode.dbNode = MyDatabaseId; + rlocator.dbOid = MyDatabaseId; if (relform->relfilenode) - rnode.relNode = relform->relfilenode; + rlocator.relNumber = relform->relfilenode; else /* Consult the relation mapper */ - rnode.relNode = RelationMapOidToFilenode(relid, - relform->relisshared); + rlocator.relNumber = RelationMapOidToFilenumber(relid, + relform->relisshared); } else { /* no storage, return NULL */ - rnode.relNode = InvalidOid; + rlocator.relNumber = InvalidRelFileNumber; /* some compilers generate warnings without these next two lines */ - rnode.dbNode = InvalidOid; - rnode.spcNode = InvalidOid; + rlocator.dbOid = InvalidOid; + rlocator.spcOid = InvalidOid; } - if (!OidIsValid(rnode.relNode)) + if (!RelFileNumberIsValid(rlocator.relNumber)) { ReleaseSysCache(tuple); PG_RETURN_NULL(); @@ -990,7 +990,7 @@ pg_relation_filepath(PG_FUNCTION_ARGS) ReleaseSysCache(tuple); - path = relpathbackend(rnode, backend, MAIN_FORKNUM); + path = relpathbackend(rlocator, backend, MAIN_FORKNUM); PG_RETURN_TEXT_P(cstring_to_text(path)); } |