mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-28 09:33:54 +02:00
PGPRO-1918: Add more informative messages
This commit is contained in:
parent
883464fdfc
commit
ad5449f1b2
@ -978,7 +978,8 @@ do_backup(time_t start_time)
|
||||
if (pgBackupCreateDir(¤t))
|
||||
elog(ERROR, "Cannot create backup directory");
|
||||
if (!lock_backup(¤t))
|
||||
elog(ERROR, "Cannot lock backup directory");
|
||||
elog(ERROR, "Cannot lock backup %s directory",
|
||||
base36enc(current.start_time));
|
||||
write_backup(¤t);
|
||||
|
||||
elog(LOG, "Backup destination is initialized");
|
||||
|
@ -433,8 +433,12 @@ catalog_lock_backup_list(parray *backup_list, int from_idx, int to_idx)
|
||||
end_idx = Min(from_idx, to_idx);
|
||||
|
||||
for (i = start_idx; i >= end_idx; i--)
|
||||
if (!lock_backup((pgBackup *) parray_get(backup_list, i)))
|
||||
elog(ERROR, "Cannot lock backup directory");
|
||||
{
|
||||
pgBackup *backup = (pgBackup *) parray_get(backup_list, i);
|
||||
if (!lock_backup(backup))
|
||||
elog(ERROR, "Cannot lock backup %s directory",
|
||||
base36enc(backup->start_time));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -207,7 +207,11 @@ do_retention_purge(void)
|
||||
* backup.
|
||||
*/
|
||||
if (!lock_backup(backup))
|
||||
{
|
||||
elog(WARNING, "Cannot lock backup %s directory, skip purging",
|
||||
base36enc(backup->start_time));
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Delete backup and update status to DELETED */
|
||||
delete_backup_files(backup);
|
||||
|
@ -318,7 +318,17 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
|
||||
|
||||
/* Do not interrupt, validate the next backup */
|
||||
if (!lock_backup(tmp_backup))
|
||||
continue;
|
||||
{
|
||||
if (is_restore)
|
||||
elog(ERROR, "Cannot lock backup %s directory",
|
||||
base36enc(tmp_backup->start_time));
|
||||
else
|
||||
{
|
||||
elog(WARNING, "Cannot lock backup %s directory, skip validation",
|
||||
base36enc(tmp_backup->start_time));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
pgBackupValidate(tmp_backup);
|
||||
/* After pgBackupValidate() only following backup
|
||||
|
@ -444,7 +444,11 @@ do_validate_instance(void)
|
||||
|
||||
/* Do not interrupt, validate the next backup */
|
||||
if (!lock_backup(current_backup))
|
||||
{
|
||||
elog(WARNING, "Cannot lock backup %s directory, skip validation",
|
||||
base36enc(current_backup->start_time));
|
||||
continue;
|
||||
}
|
||||
/* Valiate backup files*/
|
||||
pgBackupValidate(current_backup);
|
||||
|
||||
@ -532,7 +536,11 @@ do_validate_instance(void)
|
||||
{
|
||||
/* Do not interrupt, validate the next backup */
|
||||
if (!lock_backup(backup))
|
||||
{
|
||||
elog(WARNING, "Cannot lock backup %s directory, skip validation",
|
||||
base36enc(backup->start_time));
|
||||
continue;
|
||||
}
|
||||
/* Revaliate backup files*/
|
||||
pgBackupValidate(backup);
|
||||
|
||||
|
@ -327,7 +327,7 @@ class LockingTest(ProbackupTest, unittest.TestCase):
|
||||
node.slow_start()
|
||||
|
||||
# FULL
|
||||
self.backup_node(backup_dir, 'node', node)
|
||||
full_id = self.backup_node(backup_dir, 'node', node)
|
||||
|
||||
# PAGE1
|
||||
backup_id = self.backup_node(backup_dir, 'node', node, backup_type='page')
|
||||
@ -353,7 +353,7 @@ class LockingTest(ProbackupTest, unittest.TestCase):
|
||||
repr(self.output), self.cmd))
|
||||
except ProbackupException as e:
|
||||
self.assertTrue(
|
||||
"Insert expected error message" in e.message,
|
||||
"ERROR: Cannot lock backup {0} directory\n".format(full_id) in e.message,
|
||||
'\n Unexpected Error Message: {0}\n CMD: {1}'.format(
|
||||
repr(e.message), self.cmd))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user