1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-04-13 11:30:40 +02:00

Include backup_label and tablespace_map file sizes in log output.

In cases where they are returned by postgres, include backup_label and tablespace_map file sizes in the backup size value output in the log.
This commit is contained in:
Reid Thompson 2021-11-16 10:21:32 -05:00 committed by GitHub
parent 6b5322cdad
commit 1e77fc3d75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 6 deletions

View File

@ -39,6 +39,9 @@
<github-pull-request id="1562"/>
</commit>
<commit subject="Update contributor for 6e635764."/>
<commit subject="Include backup_label and tablespace_map file sizes in log output.">
<github-pull-request id="1568"/>
</commit>
<release-item-contributor-list>
<release-item-ideator id="mahomed.hussein"/>

View File

@ -888,7 +888,7 @@ backupStart(BackupData *backupData)
Stop the backup
***********************************************************************************************************************************/
// Helper to write a file from a string to the repository and update the manifest
static void
static uint64_t
backupFilePut(BackupData *backupData, Manifest *manifest, const String *name, time_t timestamp, const String *content)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
@ -899,9 +899,13 @@ backupFilePut(BackupData *backupData, Manifest *manifest, const String *name, ti
FUNCTION_LOG_PARAM(STRING, content);
FUNCTION_LOG_END();
uint64_t fileSize = 0;
// Skip files with no content
if (content != NULL)
{
fileSize = strSize(content);
MEM_CONTEXT_TEMP_BEGIN()
{
// Create file
@ -964,7 +968,7 @@ backupFilePut(BackupData *backupData, Manifest *manifest, const String *name, ti
MEM_CONTEXT_TEMP_END();
}
FUNCTION_LOG_RETURN_VOID();
FUNCTION_LOG_RETURN(UINT64, fileSize);
}
/*--------------------------------------------------------------------------------------------------------------------------------*/
@ -976,7 +980,7 @@ typedef struct BackupStopResult
} BackupStopResult;
static BackupStopResult
backupStop(BackupData *backupData, Manifest *manifest)
backupStop(BackupData *backupData, Manifest *manifest, uint64_t *backupSizeTotal)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(BACKUP_DATA, backupData);
@ -1007,8 +1011,10 @@ backupStop(BackupData *backupData, Manifest *manifest)
LOG_INFO_FMT("backup stop archive = %s, lsn = %s", strZ(result.walSegmentName), strZ(result.lsn));
// Save files returned by stop backup
backupFilePut(backupData, manifest, STRDEF(PG_FILE_BACKUPLABEL), result.timestamp, dbBackupStopResult.backupLabel);
backupFilePut(backupData, manifest, STRDEF(PG_FILE_TABLESPACEMAP), result.timestamp, dbBackupStopResult.tablespaceMap);
*backupSizeTotal += backupFilePut(
backupData, manifest, STRDEF(PG_FILE_BACKUPLABEL), result.timestamp, dbBackupStopResult.backupLabel);
*backupSizeTotal += backupFilePut(
backupData, manifest, STRDEF(PG_FILE_TABLESPACEMAP), result.timestamp, dbBackupStopResult.tablespaceMap);
}
MEM_CONTEXT_TEMP_END();
}
@ -2080,7 +2086,7 @@ cmdBackup(void)
uint64_t backupSizeTotal = backupProcess(backupData, manifest, backupStartResult.lsn, cipherPassBackup);
// Stop the backup
BackupStopResult backupStopResult = backupStop(backupData, manifest);
BackupStopResult backupStopResult = backupStop(backupData, manifest, &backupSizeTotal);
// Complete manifest
manifestBuildComplete(