MCPcopy Create free account
hub / github.com/apache/cloudberry / GetDatabasePath

Function GetDatabasePath

src/common/relpath.c:109–129  ·  view source on GitHub ↗

* GetDatabasePath - construct path to a database directory * * Result is a palloc'd string. * * XXX this must agree with GetRelationPath()! */

Source from the content-addressed store, hash-verified

107 * XXX this must agree with GetRelationPath()!
108 */
109char *
110GetDatabasePath(Oid dbNode, Oid spcNode)
111{
112 if (spcNode == GLOBALTABLESPACE_OID)
113 {
114 /* Shared system relations live in {datadir}/global */
115 Assert(dbNode == 0);
116 return pstrdup("global");
117 }
118 else if (spcNode == DEFAULTTABLESPACE_OID)
119 {
120 /* The default tablespace is {datadir}/base */
121 return psprintf("base/%u", dbNode);
122 }
123 else
124 {
125 /* All other tablespaces are accessed via symlinks */
126 return psprintf("pg_tblspc/%u/%s/%u",
127 spcNode, GP_TABLESPACE_VERSION_DIRECTORY, dbNode);
128 }
129}
130
131/*
132 * GetRelationPath - construct path to a relation's file

Callers 15

relmap_redoFunction · 0.85
InitPostgresFunction · 0.85
get_tablespace_pathFunction · 0.85
createdbFunction · 0.85
movedbFunction · 0.85
movedb_failure_callbackFunction · 0.85
remove_dbtablespacesFunction · 0.85
check_db_file_conflictFunction · 0.85
dbase_redoFunction · 0.85
TablespaceCreateDbspaceFunction · 0.85
AORelOpenSegFileXlogFunction · 0.85

Calls 2

psprintfFunction · 0.85
pstrdupFunction · 0.70

Tested by

no test coverage detected