From c857015a38edd6db641987f8084930f59cfb9309 Mon Sep 17 00:00:00 2001 From: David Steele Date: Tue, 19 Sep 2017 10:03:53 -0400 Subject: [PATCH] Fixed an issue where warnings were being emitted in place of lower priority log messages during backup from standby initialization. --- doc/xml/release.xml | 6 ++++++ lib/pgBackRest/Common/Log.pm | 4 ++-- test/lib/pgBackRestTest/Common/RunTest.pm | 6 ++++-- test/lib/pgBackRestTest/Module/Common/CommonLogTest.pm | 3 +++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 5c4baec32..75f28fbad 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -12,6 +12,12 @@ + + +

Fixed an issue where warnings were being emitted in place of lower priority log messages during backup from standby initialization.

+
+
+

Exclude contents of pg_snapshots, pg_serial, pg_notify, and pg_dynshmem from backup since they are rebuilt on startup.

diff --git a/lib/pgBackRest/Common/Log.pm b/lib/pgBackRest/Common/Log.pm index f4da9d3b6..4bd1495ef 100644 --- a/lib/pgBackRest/Common/Log.pm +++ b/lib/pgBackRest/Common/Log.pm @@ -689,8 +689,8 @@ sub log # If logging warnings as errors then change the display level and rank. These will be used to determine if the message will be # displayed or not. - my $strDisplayLevel = (!$bLogWarnOnError ? $strLevel : WARN); - my $iLogDisplayLevelRank = (!$bLogWarnOnError ? $iLogLevelRank : $oLogLevelRank{$strDisplayLevel}{rank}); + my $strDisplayLevel = ($bLogWarnOnError && $strLevel eq ERROR ? WARN : $strLevel); + my $iLogDisplayLevelRank = ($bLogWarnOnError && $strLevel eq ERROR ? $oLogLevelRank{$strDisplayLevel}{rank} : $iLogLevelRank); $strMessageFormat = ($bLogTimestamp ? timestampFormat() . sprintf('.%03d ', (gettimeofday() - int(gettimeofday())) * 1000) : '') . diff --git a/test/lib/pgBackRestTest/Common/RunTest.pm b/test/lib/pgBackRestTest/Common/RunTest.pm index 29ae284cd..c1852cf3e 100644 --- a/test/lib/pgBackRestTest/Common/RunTest.pm +++ b/test/lib/pgBackRestTest/Common/RunTest.pm @@ -291,6 +291,7 @@ sub testResult $strDescription, $iWaitSeconds, $strLogExpect, + $strLogLevel, ) = logDebugParam ( @@ -300,6 +301,7 @@ sub testResult {name => 'strDescription', trace => true}, {name => 'iWaitSeconds', optional => true, default => 0, trace => true}, {name => 'strLogExpect', optional => true, trace => true}, + {name => 'strLogLevel', optional => true, default => WARN, trace => true}, ); &log(INFO, ' ' . $strDescription); @@ -309,9 +311,9 @@ sub testResult my $oWait = waitInit($iWaitSeconds); my $bDone = false; - # Save the current log levels and set the file level to warn, console to off and timestamp false + # Save the current log levels and set the file level to strLogLevel, console to off, and timestamp false my ($strLogLevelFile, $strLogLevelConsole, $strLogLevelStdErr, $bLogTimestamp) = logLevel(); - logLevelSet(WARN, OFF, undef, false); + logLevelSet($strLogLevel, OFF, undef, false); # Clear the cache for this test logFileCacheClear(); diff --git a/test/lib/pgBackRestTest/Module/Common/CommonLogTest.pm b/test/lib/pgBackRestTest/Module/Common/CommonLogTest.pm index a2cef9454..6c358e2d9 100644 --- a/test/lib/pgBackRestTest/Module/Common/CommonLogTest.pm +++ b/test/lib/pgBackRestTest/Module/Common/CommonLogTest.pm @@ -34,6 +34,9 @@ sub run $self->testResult(sub {&log(ERROR, "my test log", 27)}, "[object]", 'log error as warning', {strLogExpect => "WARN: [027]: my test log"}); + $self->testResult(sub {&log(INFO, "my test log")}, "my test log", 'log info as info', + {strLogLevel => INFO, strLogExpect => "INFO: my test log"}); + logWarnOnErrorDisable(); $self->testResult(sub {&log(ERROR, "my test log", 27)}, "[object]", 'log error', {strLogExpect => "ERROR: [027]: my test log"});