1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-02-21 19:48:29 +02:00

Cleaning up start stop backup code.

This commit is contained in:
David Steele 2013-12-15 20:56:42 -05:00
parent 0d3fa39117
commit 6d992855d2

View File

@ -664,13 +664,15 @@ if ($strOperation eq "backup")
# Create a new backup manifest hash
my %oBackupManifest;
# Start backup
my $strLabel = "test_lablel";
&log(INFO, 'Backup start: ' . trim(execute($strCommandPsql .
" -c \"copy (select * from pg_start_backup('${strLabel}')) to stdout\" postgres")));
my $strLabel = "test_label";
my $strArchiveStart = trim(execute($strCommandPsql .
" -c \"copy (select pg_xlogfile_name(xlog) from pg_start_backup('${strLabel}') as xlog) to stdout\" postgres"));
&log(INFO, 'Backup archive start: ' . $strArchiveStart);
# Build the backup manifest
my %oTablespaceMap = tablespace_map_get($strCommandPsql);
backup_manifest_build($strCommandManifest, $strClusterDataPath, \%oBackupManifest, \%oTablespaceMap);
@ -680,18 +682,20 @@ if ($strOperation eq "backup")
$strClusterDataPath, $strBackupTmpPath, \%oBackupManifest);
# Stop backup
&log(INFO, 'Backup start: ' . trim(execute($strCommandPsql .
" -c \"copy (select * from pg_stop_backup()) to stdout\" postgres")));
my $strArchiveStop = trim(execute($strCommandPsql .
" -c \"copy (select pg_xlogfile_name(xlog) from pg_stop_backup() as xlog) to stdout\" postgres"));
&log(INFO, 'Backup archive stop: ' . $strArchiveStop);
# Fetch the archive logs and backup file
# !!! do it
#\%oBackupConfig
# Delete files leftover from a partial backup
# !!! do it
# Save the backup conf file
backup_manifest_save($strBackupConfFile, \%oBackupManifest);
backup_manifest_load($strBackupConfFile);
#tied(%oBackupManifest)->WriteConfig($strBackupConfFile);
# Rename the backup tmp path to complete the backup
# !!! Still not sure about format, probably YYYYMMDDTHH24MMSS