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

Fix expire not immediately writing into separate file after backup.

Logging stayed in the backup log until the Perl code started.  Fix this so it logs to the correct file and will still work after the Perl code is removed.
This commit is contained in:
David Steele
2019-08-17 17:43:56 -04:00
parent 41b6795a37
commit 8fc1d3883b
8 changed files with 61 additions and 51 deletions
+27 -24
View File
@@ -240,10 +240,33 @@ Attempt to set the log file and turn file logging off if the file cannot be open
the file again and error out.
***********************************************************************************************************************************/
void
cfgLoadLogFile(const String *logFile)
cfgLoadLogFile(void)
{
if (!logFileSet(strPtr(logFile)))
cfgOptionSet(cfgOptLogLevelFile, cfgSourceParam, varNewStrZ("off"));
if (cfgLogFile() && !cfgCommandHelp())
{
MEM_CONTEXT_TEMP_BEGIN()
{
// Construct log filename prefix
String *logFile = strNewFmt(
"%s/%s-", strPtr(cfgOptionStr(cfgOptLogPath)),
cfgOptionTest(cfgOptStanza) ? strPtr(cfgOptionStr(cfgOptStanza)): "all");
// If local or remote command add command name and process id
if (cfgCommand() == cfgCmdLocal || cfgCommand() == cfgCmdRemote)
{
strCatFmt(
logFile, "%s-%s-%03u.log", strPtr(cfgOptionStr(cfgOptCommand)), cfgCommandName(cfgCommand()),
cfgOptionUInt(cfgOptProcess));
}
// Else add command name
else
strCatFmt(logFile, "%s.log", cfgCommandName(cfgCommand()));
if (!logFileSet(strPtr(logFile)))
cfgOptionSet(cfgOptLogLevelFile, cfgSourceParam, varNewStrZ("off"));
}
MEM_CONTEXT_TEMP_END();
}
}
/***********************************************************************************************************************************
@@ -277,27 +300,7 @@ cfgLoad(unsigned int argListSize, const char *argList[])
ioBufferSizeSet(cfgOptionUInt(cfgOptBufferSize));
// Open the log file if this command logs to a file
if (cfgLogFile() && !cfgCommandHelp())
{
// Construct log filename prefix
String *logFile = strNewFmt(
"%s/%s-", strPtr(cfgOptionStr(cfgOptLogPath)),
cfgOptionTest(cfgOptStanza) ? strPtr(cfgOptionStr(cfgOptStanza)): "all");
// If local or remote command add command name and process id
if (cfgCommand() == cfgCmdLocal || cfgCommand() == cfgCmdRemote)
{
strCatFmt(
logFile, "%s-%s-%03u.log", strPtr(cfgOptionStr(cfgOptCommand)), cfgCommandName(cfgCommand()),
cfgOptionUInt(cfgOptProcess));
}
// Else add command name
else
strCatFmt(logFile, "%s.log", cfgCommandName(cfgCommand()));
// Set the log file name
cfgLoadLogFile(logFile);
}
cfgLoadLogFile();
// Begin the command
cmdBegin(true);
+1 -1
View File
@@ -13,7 +13,7 @@ Functions
***********************************************************************************************************************************/
void cfgLoad(unsigned int argListSize, const char *argList[]);
void cfgLoadLogSetting(void);
void cfgLoadLogFile(const String *logFile);
void cfgLoadLogFile(void);
void cfgLoadUpdateOption(void);
#endif
+2 -1
View File
@@ -115,7 +115,8 @@ main(int argListSize, const char *argList[])
// Switch to expire command
cmdEnd(0, NULL);
cfgCommandSet(cfgCmdExpire);
cmdBegin(false);
cfgLoadLogFile();
cmdBegin(true);
// Run expire
perlExec();
+15 -15
View File
@@ -117,7 +117,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base/special-!_.*'()&!@;:+,? (0
P00 INFO: full backup size = 192KB
P00 INFO: new backup label = [BACKUP-FULL-1]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --buffer-size=16384 --checksum-page --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --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 --manifest-save-threshold=3 --no-online --pg1-path=[TEST_PATH]/db-master/db/base --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --repo1-type=cifs --stanza=db --start-fast --type=full
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -378,7 +378,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base/special-!_.*'()&!@;:+,? (0
P00 INFO: full backup size = 192KB
P00 INFO: new backup label = [BACKUP-FULL-2]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire 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 --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 --test --test-delay=0.2 --test-point=backup-resume=y --type=full
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -1024,7 +1024,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base/pg_tblspc/1/
P00 INFO: incr backup size = 22B
P00 INFO: new backup label = [BACKUP-INCR-1]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --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 --test
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -1219,7 +1219,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base/pg_tblspc/1/
P00 INFO: incr backup size = 192KB
P00 INFO: new backup label = [BACKUP-INCR-2]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --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 --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 --test --test-delay=0.2 --test-point=backup-resume=y
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -1420,7 +1420,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base/pg_tblspc/1/
P00 INFO: diff backup size = 192KB
P00 INFO: new backup label = [BACKUP-DIFF-1]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --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 --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 --test --test-delay=0.2 --test-point=backup-noresume=y --type=diff
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -1616,7 +1616,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base/pg_tblspc/1/
P00 INFO: diff backup size = 192KB
P00 INFO: new backup label = [BACKUP-DIFF-2]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --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 --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 --test --test-delay=0.2 --test-point=backup-noresume=y --type=diff
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -1885,7 +1885,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base-2/base/base2
P00 INFO: incr backup size = 13B
P00 INFO: new backup label = [BACKUP-INCR-3]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --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-2 --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -2156,7 +2156,7 @@ P01 DETAIL: match file from prior backup [TEST_PATH]/db-master/db/base-2/pg_tbls
P00 INFO: incr backup size = 176KB
P00 INFO: new backup label = [BACKUP-INCR-4]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --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-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -2354,7 +2354,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base-2/pg_tblspc/
P00 INFO: diff backup size = 176KB
P00 INFO: new backup label = [BACKUP-DIFF-3]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --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 --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-2 --process-max=1 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -2531,7 +2531,7 @@ P00 TEST: PgBaCkReStTeSt-MANIFEST-BUILD-PgBaCkReStTeSt
P00 INFO: incr backup size = 0B
P00 INFO: new backup label = [BACKUP-INCR-5]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --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-2 --protocol-timeout=60 --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --test --test-delay=1 --test-point=manifest-build=y
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -2731,7 +2731,7 @@ P00 WARN: page misalignment in file [TEST_PATH]/db-master/db/base-2/pg_tblspc/
P00 INFO: diff backup size = 176KB
P00 INFO: new backup label = [BACKUP-DIFF-4]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --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 --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-2 --process-max=1 --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --test --test-delay=1 --test-point=manifest-build=y --type=diff
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -2926,7 +2926,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/pg_tblspc/2/[TS_PATH-1]/
P00 INFO: full backup size = 176KB
P00 INFO: new backup label = [BACKUP-FULL-3]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --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-2 --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=full
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -3483,7 +3483,7 @@ P00 DETAIL: hardlink pg_tblspc/2/[TS_PATH-1]/32768/tablespace2c.txt to [BACKUP-F
P00 INFO: diff backup size = 9B
P00 INFO: new backup label = [BACKUP-DIFF-5]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --checksum-page --compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --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-2 --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -3976,7 +3976,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/base/base/base2.txt (9B,
P00 INFO: diff backup size = 9B
P00 INFO: new backup label = [BACKUP-DIFF-6]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=info --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-2/base --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
@@ -4150,7 +4150,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base-2/base/base/base2.txt (9B,
P00 INFO: diff backup size = 9B
P00 INFO: new backup label = [BACKUP-DIFF-7]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --backup-standby --compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --exclude=postgresql.auto.conf --exclude=pg_log/ --exclude=pg_log2 --lock-path=[TEST_PATH]/db-master/lock --log-level-console=info --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-2/base --protocol-timeout=60 --repo1-hardlink --repo1-path=[TEST_PATH]/db-master/repo --stanza=db --start-fast --type=diff
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: expire command end: completed successfully
+2 -2
View File
@@ -3352,7 +3352,7 @@ P00 INFO: diff backup size = 9B
P00 INFO: new backup label = [BACKUP-DIFF-6]
P00 INFO: http statistics:[HTTP-STATISTICS]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-2] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass=<redacted> --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key=<redacted> --repo1-s3-key-secret=<redacted> --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: http statistics:[HTTP-STATISTICS]
P00 INFO: expire command end: completed successfully
@@ -3561,7 +3561,7 @@ P00 INFO: diff backup size = 9B
P00 INFO: new backup label = [BACKUP-DIFF-7]
P00 INFO: http statistics:[HTTP-STATISTICS]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --backup-standby --compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/backup/lock --log-level-console=info --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-2] --pg1-path=[TEST_PATH]/db-master/db/base-2/base --process-max=2 --protocol-timeout=60 --repo1-cipher-pass=<redacted> --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key=<redacted> --repo1-s3-key-secret=<redacted> --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff
P00 INFO: option 'repo1-retention-archive' is not set - archive logs will not be expired
P00 INFO: http statistics:[HTTP-STATISTICS]
P00 INFO: expire command end: completed successfully
+2 -2
View File
@@ -534,7 +534,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000
P00 INFO: full backup size = 48MB
P00 INFO: new backup label = [BACKUP-FULL-1]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --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 --repo1-retention-full=2 --stanza=db --start-fast --type=full
P00 ERROR: [029]: archive expiration cannot continue - archive and backup history lists do not match
P00 INFO: expire command end: aborted with exception [029]
@@ -713,7 +713,7 @@ P01 INFO: backup file [TEST_PATH]/db-master/db/base/pg_xlog/archive_status/000
P00 INFO: full backup size = 48MB
P00 INFO: new backup label = [BACKUP-FULL-2]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db-timeout=45 --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 --repo1-retention-full=2 --stanza=db --start-fast --type=diff
P00 INFO: remove archive path: [TEST_PATH]/db-master/repo/archive/db/9.4-2
P00 INFO: expire command end: completed successfully
+2 -2
View File
@@ -326,7 +326,7 @@ P00 INFO: new backup label = [BACKUP-FULL-1]
P00 DETAIL: tls statistics:[TLS-STATISTICS]
P00 INFO: http statistics:[HTTP-STATISTICS]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/backup/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-cipher-pass=<redacted> --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-retention-full=2 --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key=<redacted> --repo1-s3-key-secret=<redacted> --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=full
P00 INFO: remove archive path: /archive/db/9.3-1
P00 INFO: full backup total < 2 - using oldest full backup for 9.4-2 archive retention
P00 DETAIL: tls statistics:[TLS-STATISTICS]
@@ -520,7 +520,7 @@ P00 INFO: new backup label = [BACKUP-FULL-2]
P00 DETAIL: tls statistics:[TLS-STATISTICS]
P00 INFO: http statistics:[HTTP-STATISTICS]
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin
P00 INFO: expire command begin [BACKREST-VERSION]: --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --db-timeout=45 --lock-path=[TEST_PATH]/backup/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --log-subprocess --no-log-timestamp --no-online --pg1-host=db-master --pg1-host-cmd=[BACKREST-BIN] --pg1-host-config=[TEST_PATH]/db-master/pgbackrest.conf --pg1-host-user=[USER-1] --pg1-path=[TEST_PATH]/db-master/db/base --protocol-timeout=60 --repo1-cipher-pass=<redacted> --repo1-cipher-type=aes-256-cbc --repo1-path=/ --repo1-retention-full=2 --repo1-s3-bucket=pgbackrest-dev --repo1-s3-endpoint=s3.amazonaws.com --repo1-s3-key=<redacted> --repo1-s3-key-secret=<redacted> --repo1-s3-region=us-east-1 --no-repo1-s3-verify-tls --repo1-type=s3 --stanza=db --start-fast --type=diff
P00 DETAIL: tls statistics:[TLS-STATISTICS]
P00 INFO: http statistics:[HTTP-STATISTICS]
P00 INFO: expire command end: completed successfully
+10 -4
View File
@@ -320,12 +320,18 @@ testRun(void)
// *****************************************************************************************************************************
if (testBegin("cfgLoadLogFile()"))
{
cfgInit();
cfgOptionValidSet(cfgOptLogLevelFile, true);
cfgOptionSet(cfgOptLogLevelFile, cfgSourceParam, varNewStrZ("detail"));
StringList *argList = strLstNew();
strLstAdd(argList, strNew("pgbackrest"));
strLstAdd(argList, strNew("--stanza=db"));
strLstAdd(argList, strNew("--pg1-path=/path"));
strLstAdd(argList, strNew("--log-path=/bogus"));
strLstAdd(argList, strNew("--log-level-file=info"));
strLstAdd(argList, strNew("backup"));
TEST_RESULT_VOID(cfgLoad(strLstSize(argList), strLstPtr(argList)), "load config for backup");
lockRelease(true);
// On the error case is tested here, success is tested in cfgLoad()
TEST_RESULT_VOID(cfgLoadLogFile(strNew("/BOGUS")), "attempt to open bogus log file");
TEST_RESULT_VOID(cfgLoadLogFile(), "attempt to open bogus log file");
TEST_RESULT_STR(strPtr(cfgOptionStr(cfgOptLogLevelFile)), "off", "log-level-file should now be off");
}