]> xenbits.xensource.com Git - osstest.git/commitdiff
host lifecycle: Fix detection of concurrent jobs
authorIan Jackson <iwj@xenproject.org>
Wed, 7 Oct 2020 16:36:50 +0000 (17:36 +0100)
committerIan Jackson <iwj@xenproject.org>
Wed, 7 Oct 2020 17:19:40 +0000 (18:19 +0100)
The previous algorithm was wrong here.

This commit was originally considerably later than the previous one.
I'm avoiding squshing this commit, to make future archaeology easier.
The effect of the bug is to report other tasks as live too often, so
hosts show up as shared rather than reused.

Signed-off-by: Ian Jackson <iwj@xenproject.org>
Osstest/JobDB/Executive.pm

index cf82b4cf4875e1910af16689e64e596505f91bbe..3a8308e91066a351092a18eab13723ececd208ea 100644 (file)
@@ -561,17 +561,15 @@ END
 END
 
     my $ojvn = "$ho->{Ident}_lifecycle";
-    my $firstrun;
 
     if (length $r{$ojvn}) {
        my ($oldsigil,) = reverse split / /, $r{$ojvn};
        $oldsigil = '' unless $oldsigil =~ m/^\W$/;
        return if $newsigil ne '' && $oldsigil eq $newsigil;
-    } else {
-       $firstrun = 1;
     }
 
     my @lifecycle;
+    my $seen_us;
     db_retry($dbh_tests,[], sub {
        my $elided;
        @lifecycle = ();
@@ -581,10 +579,10 @@ END
 
        while (my $o = $scanq->fetchrow_hashref()) {
            my $olive =
-             # Any job which appeared since we started thinking
-             # about this must have been concurrent with us,
-             # even if it is dead now.
-             (!$firstrun || $o->{live}) &&
+             # Any job with any entry after we put ourselves in the
+             # table must have been concurrent with us, even if it is
+             # dead now.
+             ($seen_us || $o->{live}) &&
              # If this task is still live, we need to have something
              # with a live mark, generally all the prep will have
              # occurred already, so we don't mark the prep as live
@@ -597,6 +595,7 @@ END
                $o->{job} eq $job) {
                # Don't put the + mark on our own entries.
                $olivemark = '';
+               $seen_us = 1;
            }
 
            my $oisprepmark = !!$o->{isprep} && '@';