From b145c72b5c27ad299ad1fa7dcd84f45fb0797e0f Mon Sep 17 00:00:00 2001 From: David Steele Date: Mon, 25 Nov 2019 08:51:28 -0500 Subject: [PATCH] Update missing manifest warning in BackupInfo. This brings the Perl message in line with C to reduce expect log churn. --- lib/pgBackRest/Backup/Info.pm | 9 ++------- src/perl/embed.auto.c | 9 ++------- test/expect/mock-all-001.log | 8 ++++---- test/expect/mock-all-002.log | 8 ++++---- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/lib/pgBackRest/Backup/Info.pm b/lib/pgBackRest/Backup/Info.pm index 1edb21de1..8c209e786 100644 --- a/lib/pgBackRest/Backup/Info.pm +++ b/lib/pgBackRest/Backup/Info.pm @@ -335,14 +335,9 @@ sub reconstruct my $strManifestFile = "$self->{strBackupClusterPath}/${strBackup}/" . FILE_MANIFEST; my $strBackupPath = "$self->{strBackupClusterPath}/${strBackup}"; - if (!$self->{oStorage}->pathExists($strBackupPath)) + if (!$self->{oStorage}->pathExists($strBackupPath) || !$self->{oStorage}->exists($strManifestFile)) { - &log(WARN, "backup ${strBackup} missing in repository removed from " . FILE_BACKUP_INFO); - $self->delete($strBackup); - } - elsif (!$self->{oStorage}->exists($strManifestFile)) - { - &log(WARN, "backup ${strBackup} missing manifest removed from " . FILE_BACKUP_INFO); + &log(WARN, "backup '${strBackup}' missing manifest removed from " . FILE_BACKUP_INFO); $self->delete($strBackup); } } diff --git a/src/perl/embed.auto.c b/src/perl/embed.auto.c index b6e38333a..b783d53e1 100644 --- a/src/perl/embed.auto.c +++ b/src/perl/embed.auto.c @@ -2591,14 +2591,9 @@ static const EmbeddedModule embeddedModule[] = "my $strManifestFile = \"$self->{strBackupClusterPath}/${strBackup}/\" . FILE_MANIFEST;\n" "my $strBackupPath = \"$self->{strBackupClusterPath}/${strBackup}\";\n" "\n" - "if (!$self->{oStorage}->pathExists($strBackupPath))\n" + "if (!$self->{oStorage}->pathExists($strBackupPath) || !$self->{oStorage}->exists($strManifestFile))\n" "{\n" - "&log(WARN, \"backup ${strBackup} missing in repository removed from \" . FILE_BACKUP_INFO);\n" - "$self->delete($strBackup);\n" - "}\n" - "elsif (!$self->{oStorage}->exists($strManifestFile))\n" - "{\n" - "&log(WARN, \"backup ${strBackup} missing manifest removed from \" . FILE_BACKUP_INFO);\n" + "&log(WARN, \"backup '${strBackup}' missing manifest removed from \" . FILE_BACKUP_INFO);\n" "$self->delete($strBackup);\n" "}\n" "}\n" diff --git a/test/expect/mock-all-001.log b/test/expect/mock-all-001.log index 04249feca..6745dabe6 100644 --- a/test/expect/mock-all-001.log +++ b/test/expect/mock-all-001.log @@ -335,7 +335,7 @@ full backup - resume (db-master host) P00 INFO: backup command begin [BACKREST-VERSION]: --checksum-page --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --exclude=apipe --force --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=full P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. -P00 WARN: backup [BACKUP-FULL-1] missing in repository removed from backup.info +P00 WARN: backup '[BACKUP-FULL-1]' missing manifest removed from backup.info P00 WARN: --no-online passed and postmaster.pid exists but --force was passed so backup will continue though it looks like the postmaster is running and the backup will probably not be consistent P00 INFO: exclude apipe from backup using 'apipe' exclusion P00 INFO: exclude pg_log/logfile from backup using 'pg_log/' exclusion @@ -1282,7 +1282,7 @@ incr backup - resume and add tablespace 2 (db-master host) P00 INFO: backup command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. -P00 WARN: backup [BACKUP-INCR-1] missing in repository removed from backup.info +P00 WARN: backup '[BACKUP-INCR-1]' missing manifest removed from backup.info P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1] P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] P00 WARN: aborted backup [BACKUP-INCR-2] of same type exists, will be cleaned to remove invalid files and resumed @@ -1487,7 +1487,7 @@ diff backup - cannot resume - new diff (db-master host) P00 INFO: backup command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. -P00 WARN: backup [BACKUP-INCR-2] missing manifest removed from backup.info +P00 WARN: backup '[BACKUP-INCR-2]' missing manifest removed from backup.info P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1] P00 WARN: aborted backup [BACKUP-INCR-2] cannot be resumed: new backup-type 'diff' does not match aborted backup-type 'incr' P00 WARN: diff backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] @@ -1683,7 +1683,7 @@ diff backup - cannot resume - disabled / no repo link (db-master host) P00 INFO: backup command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --delta --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --log-subprocess --no-log-timestamp --no-online --pg1-path=[TEST_PATH]/db-master/db/base --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --no-resume --stanza=db --start-fast --type=diff P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. -P00 WARN: backup [BACKUP-DIFF-1] missing manifest removed from backup.info +P00 WARN: backup '[BACKUP-DIFF-1]' missing manifest removed from backup.info P00 INFO: last backup label = [BACKUP-FULL-2], version = [VERSION-1] P00 WARN: aborted backup [BACKUP-DIFF-1] cannot be resumed: resume is disabled P00 WARN: diff backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] diff --git a/test/expect/mock-all-002.log b/test/expect/mock-all-002.log index ece8983f6..907903d53 100644 --- a/test/expect/mock-all-002.log +++ b/test/expect/mock-all-002.log @@ -255,7 +255,7 @@ full backup - resume (backup host) ------------------------------------------------------------------------------------------------------------------------------------ P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. -P00 WARN: backup [BACKUP-FULL-1] missing manifest removed from backup.info +P00 WARN: backup '[BACKUP-FULL-1]' missing manifest removed from backup.info P00 WARN: --no-online passed and postmaster.pid exists but --force was passed so backup will continue though it looks like the postmaster is running and the backup will probably not be consistent P00 WARN: aborted backup [BACKUP-FULL-2] of same type exists, will be cleaned to remove invalid files and resumed @@ -740,7 +740,7 @@ incr backup - resume and add tablespace 2 (backup host) ------------------------------------------------------------------------------------------------------------------------------------ P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. -P00 WARN: backup [BACKUP-INCR-1] missing manifest removed from backup.info +P00 WARN: backup '[BACKUP-INCR-1]' missing manifest removed from backup.info P00 WARN: incr backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] P00 WARN: file pg_data/changetime.txt timestamp in the past or size changed but timestamp did not, enabling delta checksum P00 WARN: aborted backup [BACKUP-INCR-2] of same type exists, will be cleaned to remove invalid files and resumed @@ -951,7 +951,7 @@ diff backup - cannot resume - new diff (backup host) ------------------------------------------------------------------------------------------------------------------------------------ P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. -P00 WARN: backup [BACKUP-INCR-2] missing manifest removed from backup.info +P00 WARN: backup '[BACKUP-INCR-2]' missing manifest removed from backup.info P00 WARN: aborted backup [BACKUP-INCR-2] cannot be resumed: new backup-type 'diff' does not match aborted backup-type 'incr' P00 WARN: diff backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] P00 WARN: file pg_data/changetime.txt timestamp in the past or size changed but timestamp did not, enabling delta checksum @@ -1158,7 +1158,7 @@ diff backup - cannot resume - disabled / no repo link (backup host) ------------------------------------------------------------------------------------------------------------------------------------ P00 WARN: option repo1-retention-full is not set, the repository may run out of space HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum. -P00 WARN: backup [BACKUP-DIFF-1] missing manifest removed from backup.info +P00 WARN: backup '[BACKUP-DIFF-1]' missing manifest removed from backup.info P00 WARN: aborted backup [BACKUP-DIFF-1] cannot be resumed: resume is disabled P00 WARN: diff backup cannot alter 'checksum-page' option to 'false', reset to 'true' from [BACKUP-FULL-2] P00 WARN: file pg_data/changetime.txt timestamp in the past or size changed but timestamp did not, enabling delta checksum