pgbackrest.git / summary / log / commit / refs
commit 672c6b2ccb3b5926cd0e6bb0d78524d07bc74db6
Author: David Steele <github@thelabyrinth.net>
Date: Tue Aug 12 23:04:46 2014 +0000
Backup start/stop timestamp now stored in backup.manifest
README.md | 6 ------
lib/BackRest/Backup.pm | 9 ++++++++-
lib/BackRest/Utility.pm | 15 ++++++++++++---
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/README.md b/README.md
index f2110b986..772f3c1f5 100644
--- a/README.md
+++ b/README.md
@@ -12,12 +12,6 @@ Put something here, there are people to recognize!
## feature backlog
-* When resuming backups, do not resume from a backup of a different type.
-
-* Set backup dir name to date/time when backup completes (after stop backup). This indicates the time from which recovery is possible. Right now the timestamp is from the beginning of the backup which can be misleading.
-
-* Store actual backup begin and end times in backup.manifest
-
* Move backups to be removed to temp before deleting.
* Async archive-get.
diff --git a/lib/BackRest/Backup.pm b/lib/BackRest/Backup.pm
index 16dbde5b2..1174ad161 100644
--- a/lib/BackRest/Backup.pm
+++ b/lib/BackRest/Backup.pm
@@ -823,11 +823,11 @@ sub backup_manifest_build
${$oBackupManifestRef}{"${strSection}"}{"$strName"}{user} = $oManifestHash{name}{"${strName}"}{user};
${$oBackupManifestRef}{"${strSection}"}{"$strName"}{group} = $oManifestHash{name}{"${strName}"}{group};
${$oBackupManifestRef}{"${strSection}"}{"$strName"}{permission} = $oManifestHash{name}{"${strName}"}{permission};
- ${$oBackupManifestRef}{"${strSection}"}{"$strName"}{modification_time} = $oManifestHash{name}{"${strName}"}{modification_time};
if ($cType eq "f")
{
${$oBackupManifestRef}{"${strSection}"}{"$strName"}{size} = $oManifestHash{name}{"${strName}"}{size};
+ ${$oBackupManifestRef}{"${strSection}"}{"$strName"}{modification_time} = $oManifestHash{name}{"${strName}"}{modification_time};
}
if ($cType eq "f" || $cType eq "l")
@@ -1268,6 +1268,9 @@ sub backup
my $strDbClusterPath = shift;
my $bStartFast = shift;
+ # Record timestamp start
+ my $strTimestampStart = timestamp_get();
+
# Not supporting remote backup hosts yet
if ($oFile->is_remote(PATH_BACKUP))
{
@@ -1335,6 +1338,7 @@ sub backup
# Start backup
my %oBackupManifest;
${oBackupManifest}{backup}{label} = $strBackupPath;
+ ${oBackupManifest}{backup}{timestamp_start} = $strTimestampStart;
my $strArchiveStart = $oDb->backup_start($strBackupPath, $bStartFast);
${oBackupManifest}{backup}{"archive-start"} = $strArchiveStart;
@@ -1416,6 +1420,9 @@ sub backup
# Need some sort of backup validate - create a manifest and compare the backup to manifest
# !!! DO IT
+ # Record timestamp stop in the config
+ ${oBackupManifest}{backup}{timestamp_stop} = timestamp_get();
+
# Save the backup conf file final time
config_save($strBackupConfFile, \%oBackupManifest);
diff --git a/lib/BackRest/Utility.pm b/lib/BackRest/Utility.pm
index 45f16a042..e0240b341 100644
--- a/lib/BackRest/Utility.pm
+++ b/lib/BackRest/Utility.pm
@@ -22,7 +22,7 @@ our @EXPORT = qw(version_get
data_hash_build trim common_prefix wait_for_file date_string_get file_size_format execute
log log_file_set log_level_set test_set test_check
lock_file_create lock_file_remove
- config_save config_load
+ config_save config_load timestamp_get
TRACE DEBUG ERROR ASSERT WARN INFO OFF true false
TEST TEST_ENCLOSE TEST_MANIFEST_BUILD);
@@ -400,6 +400,16 @@ sub test_check
return index($strLog, TEST_ENCLOSE . '-' . $strTest . '-' . TEST_ENCLOSE) != -1;
}
+####################################################################################################################################
+# TIMESTAMP_GET - Get backrest standard timestamp
+####################################################################################################################################
+sub timestamp_get
+{
+ my ($iSecond, $iMinute, $iHour, $iMonthDay, $iMonth, $iYear, $iWeekDay, $iYearDay, $bIsDst) = localtime(time);
+
+ return sprintf("%4d-%02d-%02d %02d:%02d:%02d", $iYear + 1900, $iMonth + 1, $iMonthDay, $iHour, $iMinute, $iSecond);
+}
+
####################################################################################################################################
# LOG - log messages
####################################################################################################################################
@@ -449,8 +459,7 @@ sub log
# Format the message text
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
- $strMessageFormat = sprintf("%4d-%02d-%02d %02d:%02d:%02d", $year+1900, $mon+1, $mday, $hour, $min, $sec) .
- sprintf(" T%02d", threads->tid()) .
+ $strMessageFormat = timestamp_get() . sprintf(" T%02d", threads->tid()) .
(" " x (7 - length($strLevel))) . "${strLevel}: ${strMessageFormat}" .
(defined($iCode) ? " (code ${iCode})" : "") . "\n";
[parent: 34cb57f925e0]