mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-03-05 15:05:48 +02:00
Added some constants.
This commit is contained in:
parent
b9d9c7fa66
commit
161a73159e
@ -1392,17 +1392,18 @@ sub backup
|
||||
|
||||
if ($bNoStartStop)
|
||||
{
|
||||
if ($oFile->exists(PATH_DB_ABSOLUTE, $strDbClusterPath . '/postmaster.pid'))
|
||||
if ($oFile->exists(PATH_DB_ABSOLUTE, $strDbClusterPath . '/' . FILE_POSTMASTER_PID))
|
||||
{
|
||||
if ($bForce)
|
||||
{
|
||||
&log(WARN, '--no-start-stop passed and postmaster.pid exists but --force was passed so backup will continue, ' .
|
||||
'though it looks like the postmaster is running and the backup will probably not be consistent');
|
||||
&log(WARN, '--no-start-stop passed and ' . FILE_POSTMASTER_PID . ' exists but --force was passed so backup will ' .
|
||||
'continue though it looks like the postmaster is running and the backup will probably not be ' .
|
||||
'consistent');
|
||||
}
|
||||
else
|
||||
{
|
||||
&log(ERROR, '--no-start-stop passed but postmaster.pid exists - looks like the postmaster is running. ' .
|
||||
'Shutdown the postmaster and try again, or use --force.');
|
||||
&log(ERROR, '--no-start-stop passed but ' . FILE_POSTMASTER_PID . ' exists - looks like the postmaster is ' .
|
||||
'running. Shutdown the postmaster and try again, or use --force.');
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
@ -1514,7 +1515,7 @@ sub backup
|
||||
|
||||
# Write the VERSION file
|
||||
my $hVersionFile;
|
||||
open($hVersionFile, '>', "${strBackupTmpPath}/version") or confess 'unable to open version file';
|
||||
open($hVersionFile, '>', "${strBackupTmpPath}/" . FILE_VERSION) or confess 'unable to open version file';
|
||||
print $hVersionFile version_get();
|
||||
close($hVersionFile);
|
||||
|
||||
|
@ -18,6 +18,8 @@ use Exporter qw(import);
|
||||
|
||||
our @EXPORT = qw(config_load config_key_load operation_get operation_set param_get
|
||||
|
||||
FILE_MANIFEST FILE_VERSION FILE_POSTMASTER_PID
|
||||
|
||||
OP_ARCHIVE_GET OP_ARCHIVE_PUSH OP_BACKUP OP_RESTORE OP_EXPIRE
|
||||
|
||||
BACKUP_TYPE_FULL BACKUP_TYPE_DIFF BACKUP_TYPE_INCR
|
||||
@ -41,6 +43,16 @@ our @EXPORT = qw(config_load config_key_load operation_get operation_set param_g
|
||||
CONFIG_KEY_FULL_RETENTION CONFIG_KEY_DIFFERENTIAL_RETENTION CONFIG_KEY_ARCHIVE_RETENTION_TYPE
|
||||
CONFIG_KEY_ARCHIVE_RETENTION);
|
||||
|
||||
####################################################################################################################################
|
||||
# File/path constants
|
||||
####################################################################################################################################
|
||||
use constant
|
||||
{
|
||||
FILE_MANIFEST => 'backup.manifest',
|
||||
FILE_VERSION => 'version',
|
||||
FILE_POSTMASTER_PID => 'postmaster.pid'
|
||||
};
|
||||
|
||||
####################################################################################################################################
|
||||
# Operation constants - basic operations that are allowed in backrest
|
||||
####################################################################################################################################
|
||||
|
@ -58,7 +58,7 @@ sub restore
|
||||
my $self = shift; # Class hash
|
||||
|
||||
# Make sure that Postgres is not running
|
||||
if ($self->{oFile}->exists(PATH_DB_ABSOLUTE, $self->{strDbClusterPath} . '/postmaster.pid'))
|
||||
if ($self->{oFile}->exists(PATH_DB_ABSOLUTE, $self->{strDbClusterPath} . '/' . FILE_POSTMASTER_PID))
|
||||
{
|
||||
confess &log(ERROR, 'unable to restore while Postgres is running');
|
||||
}
|
||||
@ -67,14 +67,14 @@ sub restore
|
||||
if ($self->{oFile}->exists(PATH_BACKUP_CLUSTER, $self->{strBackupPath}))
|
||||
{
|
||||
# Copy the backup manifest to the db cluster path
|
||||
$self->{oFile}->copy(PATH_BACKUP_CLUSTER, $self->{strBackupPath} . '/backup.manifest',
|
||||
PATH_DB_ABSOLUTE, $self->{strDbClusterPath} . '/backup.manifest');
|
||||
$self->{oFile}->copy(PATH_BACKUP_CLUSTER, $self->{strBackupPath} . '/' . FILE_MANIFEST,
|
||||
PATH_DB_ABSOLUTE, $self->{strDbClusterPath} . '/' . FILE_MANIFEST);
|
||||
|
||||
# Load the manifest into a hash
|
||||
ini_load($self->{oFile}->path_get(PATH_DB_ABSOLUTE, $self->{strDbClusterPath} . '/backup.manifest'));
|
||||
ini_load($self->{oFile}->path_get(PATH_DB_ABSOLUTE, $self->{strDbClusterPath} . '/' . FILE_MANIFEST));
|
||||
|
||||
# Remove the manifest now that it is in memory
|
||||
$self->{oFile}->remove(PATH_DB_ABSOLUTE, $self->{strDbClusterPath} . '/backup.manifest');
|
||||
$self->{oFile}->remove(PATH_DB_ABSOLUTE, $self->{strDbClusterPath} . '/' . FILE_MANIFEST);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user