1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Clarified error message when unable to acquire pgBackRest advisory lock to make it clear that it is not a PostgreSQL backup lock.

Suggested by Jens Wilke.
This commit is contained in:
David Steele 2016-10-05 21:13:29 -04:00
parent 5dc801d59d
commit 0a4099fff8
3 changed files with 15 additions and 4 deletions

View File

@ -178,6 +178,14 @@
</release-feature-list>
<release-refactor-list>
<release-item>
<release-item-contributor-list>
<release-item-ideator id="wilke.jens"/>
</release-item-contributor-list>
<p>Clarified error message when unable to acquire <backrest/> advisory lock to make it clear that it is not a <postgres/> backup lock.</p>
</release-item>
<release-item>
<p><backrest/> version number included in command start INFO log output.</p>
</release-item>

View File

@ -641,8 +641,8 @@ sub backupStart
# database cluster. This lock helps make the stop-auto option safe.
if (!$self->executeSqlOne('select pg_try_advisory_lock(' . DB_BACKUP_ADVISORY_LOCK . ')'))
{
confess &log(ERROR, "unable to acquire backup lock\n" .
'HINT: is another backup already running on this cluster?', ERROR_LOCK_ACQUIRE);
confess &log(ERROR, 'unable to acquire ' . BACKREST_NAME . " advisory lock\n" .
'HINT: is another ' . BACKREST_NAME . ' backup already running on this cluster?', ERROR_LOCK_ACQUIRE);
}
# If stop-auto is enabled check for a running backup. This feature is not supported for PostgreSQL >= 9.6 since backups are
@ -655,7 +655,7 @@ sub backupStart
# If a backup is currently in progress emit a warning and then stop it
if ($self->executeSqlOne('select pg_is_in_backup()'))
{
&log(WARN, 'the cluster is already in backup mode but no backup process is running.' .
&log(WARN, 'the cluster is already in backup mode but no ' . BACKREST_NAME . ' backup process is running.' .
' pg_stop_backup() will be called so a new backup can be started.');
$self->backupStop();
}

View File

@ -2083,13 +2083,16 @@ sub backupTestRun
# are run in non-exlusive mode.
if ($bTestExtra && $oHostDbMaster->dbVersion() >= PG_VERSION_93 && $oHostDbMaster->dbVersion() < PG_VERSION_96)
{
$oHostDbMaster->sqlSelectOne("select pg_start_backup('test backup that will be cancelled', true)");
$oHostDbMaster->sqlSelectOne("select pg_start_backup('test backup that will cause an error', true)");
# Verify that an error is returned if the backup is already running
$oHostBackup->backup($strType, 'fail on backup already running', {iExpectedExitStatus => ERROR_DB_QUERY});
# Restart the cluster ignoring any errors in the postgresql log
$oHostDbMaster->clusterRestart({bIgnoreLogError => true});
# Start a new backup to make the next test restart it
$oHostDbMaster->sqlSelectOne("select pg_start_backup('test backup that will be restarted', true)");
}
$oExecuteBackup = $oHostBackup->backupBegin(