Fix a race condition in hydra-update-gc-roots

[?]
Mar 7, 2012, 2:12 PM
SZPBGW2NVHOOW4E3VIB2B35V7YRF67DFVVGUK573LVD574IHSA6AC

Dependencies

  • [2] KJQWSRCC Speed up hydra-update-gc-roots
  • [3] NEWDDAOF * Allow users to change the value of a build's "keep" flag, which
  • [4] WZ3AEJ67 * hydra_update_gc_roots.pl registers build outputs that should be kept
  • [5] 2T42QGZD * Register builds as GC roots so they don't get deleted.

Change contents

  • edit in src/script/hydra-update-gc-roots at line 46
    [3.1148]
    [2.720]
    # Read the current GC roots. We need to do that here so that we don't
    # delete roots that were added while we were determining the desired
    # roots.
    print STDERR "*** reading current roots...\n";
    my $gcRootsDir = getGCRootsDir;
    opendir DIR, $gcRootsDir or die;
    my @roots = readdir DIR;
    closedir DIR;
  • replacement in src/script/hydra-update-gc-roots at line 126
    [3.1970][3.1970:2031]()
    # Remove existing roots that are no longer wanted. !!! racy
    [3.1970]
    [3.2435]
    # Remove existing roots that are no longer wanted.
  • edit in src/script/hydra-update-gc-roots at line 128
    [3.2484][3.992:1026](),[3.992][3.992:1026](),[3.1026][3.2031:2064](),[3.2031][3.2031:2064]()
    my $gcRootsDir = getGCRootsDir;
    opendir DIR, $gcRootsDir or die;
  • replacement in src/script/hydra-update-gc-roots at line 132
    [3.2065][3.2065:2098]()
    foreach my $link (readdir DIR) {
    [3.2065]
    [2.2767]
    foreach my $link (@roots) {
  • replacement in src/script/hydra-update-gc-roots at line 138
    [2.2864][2.2864:2942]()
    unlink "$gcRootsDir/$link" or warn "cannot remove $gcRootsDir/$link";
    [2.2864]
    [2.2942]
    #unlink "$gcRootsDir/$link" or warn "cannot remove $gcRootsDir/$link";
  • edit in src/script/hydra-update-gc-roots at line 144
    [3.2353][3.2353:2367](),[3.2367][2.2971:2972]()
    closedir DIR;