From a1341b4af013a757c60de0f0595e2839f2ac27e6 Mon Sep 17 00:00:00 2001 From: David Steele Date: Sun, 28 Feb 2021 17:00:41 -0500 Subject: [PATCH] Make S3/Azure file missing error messages match Posix. The S3 driver was missed when the constants were added and then Azure was copied from S3. --- src/storage/azure/read.c | 2 +- src/storage/s3/read.c | 2 +- test/expect/mock-archive-002.log | 8 ++++---- test/expect/mock-stanza-002.log | 4 ++-- test/src/module/storage/azureTest.c | 2 +- test/src/module/storage/s3Test.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/storage/azure/read.c b/src/storage/azure/read.c index dce69bfdc..f63e915d4 100644 --- a/src/storage/azure/read.c +++ b/src/storage/azure/read.c @@ -65,7 +65,7 @@ storageReadAzureOpen(THIS_VOID) } // Else error unless ignore missing else if (!this->interface.ignoreMissing) - THROW_FMT(FileMissingError, "unable to open '%s': No such file or directory", strZ(this->interface.name)); + THROW_FMT(FileMissingError, STORAGE_ERROR_READ_MISSING, strZ(this->interface.name)); FUNCTION_LOG_RETURN(BOOL, result); } diff --git a/src/storage/s3/read.c b/src/storage/s3/read.c index baeb7c52f..75990d918 100644 --- a/src/storage/s3/read.c +++ b/src/storage/s3/read.c @@ -65,7 +65,7 @@ storageReadS3Open(THIS_VOID) } // Else error unless ignore missing else if (!this->interface.ignoreMissing) - THROW_FMT(FileMissingError, "unable to open '%s': No such file or directory", strZ(this->interface.name)); + THROW_FMT(FileMissingError, STORAGE_ERROR_READ_MISSING, strZ(this->interface.name)); FUNCTION_LOG_RETURN(BOOL, result); } diff --git a/test/expect/mock-archive-002.log b/test/expect/mock-archive-002.log index 2317db6f3..daf9abe21 100644 --- a/test/expect/mock-archive-002.log +++ b/test/expect/mock-archive-002.log @@ -5,8 +5,8 @@ run 002 - rmt 1, storage s3, enc 0, cmp zst ------------------------------------------------------------------------------------------------------------------------------------ P00 INFO: archive-push command begin [BACKREST-VERSION]: [[TEST_PATH]/db-primary/db/base/pg_xlog/000000010000000100000001] --buffer-size=[BUFFER-SIZE] --compress-level=3 --compress-level-network=1 --compress-type=none --config=[TEST_PATH]/db-primary/pgbackrest.conf --db-timeout=45 --exec-id=[EXEC-ID] --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base --protocol-timeout=60 --repo1-host=backup --repo1-host-cmd=[BACKREST-BIN] --repo1-host-config=[TEST_PATH]/backup/pgbackrest.conf --repo1-host-user=[USER-1] --stanza=db P00 ERROR: [055]: unable to load info file '/archive/db/archive.info' or '/archive/db/archive.info.copy': - FileMissingError: raised from remote-0 protocol on 'backup': unable to open '/archive/db/archive.info': No such file or directory - FileMissingError: raised from remote-0 protocol on 'backup': unable to open '/archive/db/archive.info.copy': No such file or directory + FileMissingError: raised from remote-0 protocol on 'backup': unable to open missing file '/archive/db/archive.info' for read + FileMissingError: raised from remote-0 protocol on 'backup': unable to open missing file '/archive/db/archive.info.copy' for read HINT: archive.info cannot be opened but is required to push/get WAL segments. HINT: is archive_command configured correctly in postgresql.conf? HINT: has a stanza-create been performed? @@ -17,8 +17,8 @@ P00 INFO: archive-push command end: aborted with exception [055] ------------------------------------------------------------------------------------------------------------------------------------ P00 INFO: archive-get command begin [BACKREST-VERSION]: [000000010000000100000001, [TEST_PATH]/db-primary/db/base/pg_xlog/RECOVERYXLOG] --buffer-size=[BUFFER-SIZE] --compress-level-network=1 --config=[TEST_PATH]/db-primary/pgbackrest.conf --db-timeout=45 --exec-id=[EXEC-ID] --job-retry=0 --lock-path=[TEST_PATH]/db-primary/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/db-primary/log[] --no-log-timestamp --pg1-path=[TEST_PATH]/db-primary/db/base --protocol-timeout=60 --repo1-host=backup --repo1-host-cmd=[BACKREST-BIN] --repo1-host-config=[TEST_PATH]/backup/pgbackrest.conf --repo1-host-user=[USER-1] --stanza=db P00 WARN: repo1: [FileMissingError] unable to load info file '/archive/db/archive.info' or '/archive/db/archive.info.copy': - FileMissingError: raised from remote-0 protocol on 'backup': unable to open '/archive/db/archive.info': No such file or directory - FileMissingError: raised from remote-0 protocol on 'backup': unable to open '/archive/db/archive.info.copy': No such file or directory + FileMissingError: raised from remote-0 protocol on 'backup': unable to open missing file '/archive/db/archive.info' for read + FileMissingError: raised from remote-0 protocol on 'backup': unable to open missing file '/archive/db/archive.info.copy' for read HINT: archive.info cannot be opened but is required to push/get WAL segments. HINT: is archive_command configured correctly in postgresql.conf? HINT: has a stanza-create been performed? diff --git a/test/expect/mock-stanza-002.log b/test/expect/mock-stanza-002.log index a291d6137..6d160bae4 100644 --- a/test/expect/mock-stanza-002.log +++ b/test/expect/mock-stanza-002.log @@ -14,8 +14,8 @@ stanza-upgrade db - fail on stanza not initialized since archive.info is missing P00 INFO: stanza-upgrade command begin [BACKREST-VERSION]: --buffer-size=[BUFFER-SIZE] --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --exec-id=[EXEC-ID] --lock-path=[TEST_PATH]/backup/lock --log-level-console=detail --log-level-file=[LOG-LEVEL-FILE] --log-level-stderr=off --log-path=[TEST_PATH]/backup/log[] --no-log-timestamp --no-online --pg1-host=db-primary --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-primary/pgbackrest.conf --pg1-host-user=[USER-1] --pg1-path=[TEST_PATH]/db-primary/db/base --protocol-timeout=60 --repo1-azure-account= --repo1-azure-container=azContainer --repo1-azure-host=azure --repo1-azure-key= --no-repo1-azure-verify-tls --repo1-cipher-pass= --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-type=azure --stanza=db P00 INFO: stanza-upgrade for stanza 'db' on repo1 P00 ERROR: [055]: unable to load info file '/archive/db/archive.info' or '/archive/db/archive.info.copy': - FileMissingError: unable to open '/archive/db/archive.info': No such file or directory - FileMissingError: unable to open '/archive/db/archive.info.copy': No such file or directory + FileMissingError: unable to open missing file '/archive/db/archive.info' for read + FileMissingError: unable to open missing file '/archive/db/archive.info.copy' for read HINT: archive.info cannot be opened but is required to push/get WAL segments. HINT: is archive_command configured correctly in postgresql.conf? HINT: has a stanza-create been performed? diff --git a/test/src/module/storage/azureTest.c b/test/src/module/storage/azureTest.c index 5e7ef5a12..0a39b581f 100644 --- a/test/src/module/storage/azureTest.c +++ b/test/src/module/storage/azureTest.c @@ -324,7 +324,7 @@ testRun(void) TEST_ERROR( storageGetP(storageNewReadP(storage, strNew("file.txt"))), FileMissingError, - "unable to open '/file.txt': No such file or directory"); + "unable to open missing file '/file.txt' for read"); // ----------------------------------------------------------------------------------------------------------------- TEST_TITLE("get file"); diff --git a/test/src/module/storage/s3Test.c b/test/src/module/storage/s3Test.c index f392cba82..333bb960e 100644 --- a/test/src/module/storage/s3Test.c +++ b/test/src/module/storage/s3Test.c @@ -416,7 +416,7 @@ testRun(void) TEST_ERROR( storageGetP(storageNewReadP(s3, strNew("file.txt"))), FileMissingError, - "unable to open '/file.txt': No such file or directory"); + "unable to open missing file '/file.txt' for read"); // ----------------------------------------------------------------------------------------------------------------- TEST_TITLE("get file");