1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-05-22 10:15:16 +02:00

Remove unneeded backupTimeStart parameter from testBackupValidate().

5ce8b9df added this parameter, but it is better to get the value from the manifest, which is already present.
This commit is contained in:
David Steele
2024-02-05 10:10:59 -03:00
parent 45f070aa9a
commit ad8e92a9ac
+11 -18
View File
@@ -26,8 +26,8 @@ Get a list of all files in the backup and a redacted version of the manifest tha
static String * static String *
testBackupValidateFile( testBackupValidateFile(
const Storage *const storage, const String *const path, Manifest *const manifest, const ManifestData *const manifestData, const Storage *const storage, const String *const path, Manifest *const manifest, const ManifestData *const manifestData,
const String *const fileName, uint64_t fileSize, ManifestFilePack **const filePack, const time_t backupTimeStart, const String *const fileName, uint64_t fileSize, ManifestFilePack **const filePack, const CipherType cipherType,
const CipherType cipherType, const String *const cipherPass) const String *const cipherPass)
{ {
FUNCTION_HARNESS_BEGIN(); FUNCTION_HARNESS_BEGIN();
FUNCTION_HARNESS_PARAM(STORAGE, storage); FUNCTION_HARNESS_PARAM(STORAGE, storage);
@@ -37,7 +37,6 @@ testBackupValidateFile(
FUNCTION_HARNESS_PARAM(STRING, fileName); FUNCTION_HARNESS_PARAM(STRING, fileName);
FUNCTION_HARNESS_PARAM(UINT64, fileSize); FUNCTION_HARNESS_PARAM(UINT64, fileSize);
FUNCTION_HARNESS_PARAM_P(VOID, filePack); FUNCTION_HARNESS_PARAM_P(VOID, filePack);
FUNCTION_HARNESS_PARAM(TIME, backupTimeStart);
FUNCTION_HARNESS_PARAM(STRING_ID, cipherType); FUNCTION_HARNESS_PARAM(STRING_ID, cipherType);
FUNCTION_HARNESS_PARAM(STRING, cipherPass); FUNCTION_HARNESS_PARAM(STRING, cipherPass);
FUNCTION_HARNESS_END(); FUNCTION_HARNESS_END();
@@ -203,11 +202,11 @@ testBackupValidateFile(
// Timestamp // Timestamp
// ------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------
if (file.timestamp != backupTimeStart) if (file.timestamp != manifestData->backupTimestampStart)
{ {
strCatFmt( strCatFmt(
result, ", ts=%s%" PRId64, file.timestamp > backupTimeStart ? "+" : "", result, ", ts=%s%" PRId64, file.timestamp > manifestData->backupTimestampStart ? "+" : "",
(int64_t)file.timestamp - (int64_t)backupTimeStart); (int64_t)file.timestamp - (int64_t)manifestData->backupTimestampStart);
} }
// Page checksum // Page checksum
@@ -248,8 +247,7 @@ testBackupValidateFile(
static String * static String *
testBackupValidateList( testBackupValidateList(
const Storage *const storage, const String *const path, Manifest *const manifest, const ManifestData *const manifestData, const Storage *const storage, const String *const path, Manifest *const manifest, const ManifestData *const manifestData,
StringList *const manifestFileList, const time_t backupTimeStart, const CipherType cipherType, const String *const cipherPass, StringList *const manifestFileList, const CipherType cipherType, const String *const cipherPass, String *const result)
String *const result)
{ {
FUNCTION_HARNESS_BEGIN(); FUNCTION_HARNESS_BEGIN();
FUNCTION_HARNESS_PARAM(STORAGE, storage); FUNCTION_HARNESS_PARAM(STORAGE, storage);
@@ -257,7 +255,6 @@ testBackupValidateList(
FUNCTION_HARNESS_PARAM(MANIFEST, manifest); FUNCTION_HARNESS_PARAM(MANIFEST, manifest);
FUNCTION_HARNESS_PARAM_P(VOID, manifestData); FUNCTION_HARNESS_PARAM_P(VOID, manifestData);
FUNCTION_HARNESS_PARAM(STRING_LIST, manifestFileList); FUNCTION_HARNESS_PARAM(STRING_LIST, manifestFileList);
FUNCTION_HARNESS_PARAM(TIME, backupTimeStart);
FUNCTION_HARNESS_PARAM(STRING_ID, cipherType); FUNCTION_HARNESS_PARAM(STRING_ID, cipherType);
FUNCTION_HARNESS_PARAM(STRING, cipherPass); FUNCTION_HARNESS_PARAM(STRING, cipherPass);
FUNCTION_HARNESS_PARAM(STRING, result); FUNCTION_HARNESS_PARAM(STRING, result);
@@ -351,8 +348,7 @@ testBackupValidateList(
strCat( strCat(
result, result,
testBackupValidateFile( testBackupValidateFile(
storage, path, manifest, manifestData, info.name, info.size, filePack, backupTimeStart, cipherType, storage, path, manifest, manifestData, info.name, info.size, filePack, cipherType, cipherPass));
cipherPass));
} }
break; break;
@@ -403,16 +399,14 @@ typedef struct TestBackupValidateParam
} TestBackupValidateParam; } TestBackupValidateParam;
#define testBackupValidateP(storage, path, ...) \ #define testBackupValidateP(storage, path, ...) \
testBackupValidate(storage, path, backupTimeStart, (TestBackupValidateParam){VAR_PARAM_INIT, __VA_ARGS__}) testBackupValidate(storage, path, (TestBackupValidateParam){VAR_PARAM_INIT, __VA_ARGS__})
static String * static String *
testBackupValidate( testBackupValidate(const Storage *const storage, const String *const path, const TestBackupValidateParam param)
const Storage *const storage, const String *const path, const time_t backupTimeStart, const TestBackupValidateParam param)
{ {
FUNCTION_HARNESS_BEGIN(); FUNCTION_HARNESS_BEGIN();
FUNCTION_HARNESS_PARAM(STORAGE, storage); FUNCTION_HARNESS_PARAM(STORAGE, storage);
FUNCTION_HARNESS_PARAM(STRING, path); FUNCTION_HARNESS_PARAM(STRING, path);
FUNCTION_HARNESS_PARAM(TIME, backupTimeStart);
FUNCTION_HARNESS_PARAM(UINT64, param.cipherType); FUNCTION_HARNESS_PARAM(UINT64, param.cipherType);
FUNCTION_HARNESS_PARAM(STRINGZ, param.cipherPass); FUNCTION_HARNESS_PARAM(STRINGZ, param.cipherPass);
FUNCTION_HARNESS_END(); FUNCTION_HARNESS_END();
@@ -443,8 +437,7 @@ testBackupValidate(
const CipherType cipherType = param.cipherType == 0 ? cipherTypeNone : param.cipherType; const CipherType cipherType = param.cipherType == 0 ? cipherTypeNone : param.cipherType;
const String *const cipherPass = param.cipherPass == NULL ? NULL : manifestCipherSubPass(manifest); const String *const cipherPass = param.cipherPass == NULL ? NULL : manifestCipherSubPass(manifest);
testBackupValidateList( testBackupValidateList(storage, path, manifest, manifestData(manifest), manifestFileList, cipherType, cipherPass, result);
storage, path, manifest, manifestData(manifest), manifestFileList, backupTimeStart, cipherType, cipherPass, result);
// Check remaining files in the manifest -- these should all be references // Check remaining files in the manifest -- these should all be references
for (unsigned int manifestFileIdx = 0; manifestFileIdx < strLstSize(manifestFileList); manifestFileIdx++) for (unsigned int manifestFileIdx = 0; manifestFileIdx < strLstSize(manifestFileList); manifestFileIdx++)
@@ -472,7 +465,7 @@ testBackupValidate(
.compressType = manifestData(manifest)->backupOptionCompressType, .compressType = manifestData(manifest)->backupOptionCompressType,
.blockIncr = file.blockIncrMapSize != 0), .blockIncr = file.blockIncrMapSize != 0),
sizeof(STORAGE_REPO_BACKUP)), sizeof(STORAGE_REPO_BACKUP)),
file.sizeRepo, filePack, backupTimeStart, cipherType, cipherPass)); file.sizeRepo, filePack, cipherType, cipherPass));
} }
// Make sure both backup.manifest files exist since we skipped them in the callback above // Make sure both backup.manifest files exist since we skipped them in the callback above