Build new manifest inside a temporary context.
There is a fair amount of temporary data that is created during the build and it should not end up as a permanent part of the manifest.
@@ -876,6 +876,8 @@ manifestNewBuild(
this->data.backupOptionOnline = online;
this->data.backupOptionChecksumPage = varNewBool(checksumPage);
+ MEM_CONTEXT_TEMP_BEGIN()
+ {
// Data needed to build the manifest
ManifestBuildData buildData =
{
@@ -890,9 +892,9 @@ manifestNewBuild(
.pgPath = storagePathP(storagePg, NULL),
};
- // We won't identify db paths for PostgreSQL < 9.0. This means that temp relations will not be excluded but it doesn't seem
- // worth supporting this feature on such old versions of PostgreSQL.
- // -------------------------------------------------------------------------------------------------------------------------
+ // We won't identify db paths for PostgreSQL < 9.0. This means that temp relations will not be excluded but it doesn't
+ // seem worth supporting this feature on such old versions of PostgreSQL.
+ // ---------------------------------------------------------------------------------------------------------------------
if (pgVersion >= PG_VERSION_90)
{
ASSERT(buildData.tablespaceId != NULL);
@@ -905,7 +907,7 @@ manifestNewBuild(
}
// Build expression to identify files that can be copied from the standby when standby backup is supported
- // -------------------------------------------------------------------------------------------------------------------------
+ // ---------------------------------------------------------------------------------------------------------------------
buildData.standbyExp = regExpNew(
strNewFmt(
"^((" MANIFEST_TARGET_PGDATA "/(" PG_PATH_BASE "|" PG_PATH_GLOBAL "|%s|" PG_PATH_PGMULTIXACT "))|"
@@ -913,7 +915,7 @@ manifestNewBuild(
strPtr(pgXactPath(pgVersion))));
// Build list of exclusions
- // -------------------------------------------------------------------------------------------------------------------------
+ // ---------------------------------------------------------------------------------------------------------------------
if (excludeList != NULL)
{
for (unsigned int excludeIdx = 0; excludeIdx < strLstSize(excludeList); excludeIdx++)
@@ -940,7 +942,7 @@ manifestNewBuild(
}
// Build manifest
- // -------------------------------------------------------------------------------------------------------------------------
+ // ---------------------------------------------------------------------------------------------------------------------
StorageInfo info = storageInfoP(storagePg, buildData.pgPath, .followLink = true);
ManifestPath path =
@@ -972,9 +974,9 @@ manifestNewBuild(
lstSort(this->pathList, sortOrderAsc);
lstSort(this->targetList, sortOrderAsc);
- // Remove unlogged relations from the manifest. This can't be done during the initial build because of the requirement to
- // check for _init files which will sort after the vast majority of the relation files. We could check storage for each
- // _init file but that would be expensive.
+ // Remove unlogged relations from the manifest. This can't be done during the initial build because of the requirement
+ // to check for _init files which will sort after the vast majority of the relation files. We could check storage for
+ // each _init file but that would be expensive.
// -------------------------------------------------------------------------------------------------------------------------
if (pgVersion >= PG_VERSION_91)
{
@@ -1008,7 +1010,8 @@ manifestNewBuild(
if (lastRelationFileId == NULL || !strEq(lastRelationFileId, relationFileId))
{
// Determine if the relation is unlogged
- const String *relationInit = strNewFmt("%s/%s_init", strPtr(strPath(file->name)), strPtr(relationFileId));
+ const String *relationInit = strNewFmt(
+ "%s/%s_init", strPtr(strPath(file->name)), strPtr(relationFileId));
lastRelationFileId = relationFileId;
lastRelationFileIdUnlogged = manifestFileFindDefault(this, relationInit, NULL) != NULL;
}
@@ -1025,6 +1028,8 @@ manifestNewBuild(
}
}
}
+ MEM_CONTEXT_TEMP_END();
+ }
MEM_CONTEXT_NEW_END();
FUNCTION_LOG_RETURN(MANIFEST, this);
