[Dirvish] expiry rules

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Tue Jul 19 10:12:06 UTC 2011


Dave Howorth wrote:
> I finally managed to find my bug. It'll be a couple of days whilst I
> check that it at least seems to really work in my installation and then
> I'll post it.

OK. It seems to work. On appropriate occasions, it produces messages like:

  cannot expire pcx36-root:default:2011-07-13 It's the latest good image

I've attached the modified dirvish-expire to this message and here's a
diff from the previous version (caveat! The previous version may or may
not be exactly what I originally downloaded!)

Cheers, Dave

--- dirvish-expire      2011-03-17 15:31:58.000000000 +0000
+++ dirvish-expire-new  2011-07-19 11:00:08.000000000 +0100
@@ -109,6 +109,7 @@
 $$Options{time} and $expire_time = parsedate($$Options{time});
 $expire_time ||= time;

+my %recent;

 if ($$Options{vault})
 {
@@ -150,7 +151,20 @@
        my ($created, $expired);
        ($created = $$expire{created}) =~ s/:\d\d$//;
        ($expired = $$expire{expire}) =~ s/:\d\d$//;
-
+
+       my $vault  = $$expire{vault};
+       my $branch = $$expire{branch};
+
+       if ($recent{$vault}{$branch} eq $created)
+       {
+               printf "cannot expire %s:%s:%s It's the latest good
image\n",
+                       $vault,
+                       $branch,
+                       $$expire{image};
+               ++$unexpired{$vault}{$branch};
+               next;
+       }
+
        if (!$unexpired{$$expire{vault}}{$$expire{branch}})
        {
                printf "cannot expire %s:%s:%s No unexpired good images\n",
@@ -224,6 +238,19 @@
                $$summary{vault} && $$summary{branch} && $$summary{Image}
                        or return;

+               my ($vault, $branch, $success, $created, $recent);
+
+               $vault   = $$summary{vault};
+               $branch  = $$summary{branch};
+               $success = $$summary{Status} =~ /^success/ && -d ($path
. '/tree');
+               ($created = $$summary{'Backup-complete'}) =~ s/:\d\d$//;
+               $recent  = $recent{$vault}{$branch};
+
+               if ($success and (!defined($recent) or $recent lt $created))
+               {
+                       $recent{$vault}{$branch} = $created;
+               }
+
                if ($status == 0)
                {
                        $$summary{Status} =~ /^success/ && -d ($path .
'/tree')
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dirvish-expire-new
Url: http://www.dirvish.org/pipermail/dirvish/attachments/20110719/dab3abde/attachment.pl 


More information about the Dirvish mailing list