IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 12, 2017, 5:24:10 PM (10 years ago)
Author:
watersc1
Message:

Unsafe version of rawcheck.pl that doesn't check every instance, only checking enough copies to find a valid instance. This should be somewhat faster, as it does not require the md5sums that are building up on b node hosts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/rawcheck.pl

    r39933 r39942  
    205205    my $existing_copies = 0;
    206206    my $Ngood = 0;
     207    my $Nbad  = 0;
    207208    my %good_instances = ();
    208209    my %bad_instances  = ();
     210
     211    #unsafe
     212    my $continue_checking_md5sums = 1;
     213    my %good_instances_unchecked  = ();
     214    #end unsafe
    209215
    210216    my @files = map {URI->new($_)->file if $_} @$instances;
     
    220226            $instance_exists = 1;
    221227            $existing_copies++;
    222             $instance_md5sum = local_md5sum($files[$i]);
    223             if ($instance_md5sum eq $md5sum) {
    224                 push @{ $good_instances{$instance_site} }, $i;
     228            if ($continue_checking_md5sums == 1) { #unsafe
     229                $instance_md5sum = local_md5sum($files[$i]);
     230                if ($instance_md5sum eq $md5sum) {
     231                    push @{ $good_instances{$instance_site} }, $i;
     232                    $is_good = 1;
     233                    $Ngood++;
     234                }               
     235                else {
     236                    push @{ $bad_instances{$instance_site} }, $i;
     237                    $Nbad++;
     238                }
     239            } #unsafe
     240            else { #unsafe
     241                $instance_md5sum = 'CHECKING_STOPPED';
     242                push @{ $good_instances_unchecked{$instance_site} }, $i;
    225243                $is_good = 1;
    226244                $Ngood++;
    227             }           
    228             else {
    229                 push @{ $bad_instances{$instance_site} }, $i;
    230             }
     245            } #end unsafe
    231246        }
    232247        else {
     
    239254                                  $instance_exists,$is_good,$instance_md5sum,
    240255                                  $files[$i],$instance_host,$instance_volume);
     256
     257        #unsafe
     258        # Remove this section when we decide to go back to actually checking everything
     259        # to make sure we don't have any secret data corruption
     260        if ($Ngood > 0) {
     261            print "# Breaking from validation check, as a valid copy has been found.\n";
     262            $continue_checking_md5sums = 0;
     263        }
     264        #end unsafe
    241265    }
    242266
     
    297321    ## leave everything in the best state possible.
    298322    printf(">> %d %d\n",$Ngood, $#files + 1);
    299     if ($Ngood != $#files + 1) {
     323#    if ($Ngood != $#files + 1) {
     324    if ($Nbad > 0) {
    300325        my $good_copy;
    301326        my $good_copy_index;
     
    328353        if ($do_cull == 1) { $do_cull = -1; }
    329354    }
     355
     356    #unsafe
     357    foreach my $site_key (keys %good_instances_unchecked) {
     358        push @{ $good_instances{$site_key} }, @{ $good_instances_unchecked{$site_key} };
     359    }
     360    #end unsafe
    330361
    331362    ## We can now attempt to make replicated copies to the sites that require additional copies.
Note: See TracChangeset for help on using the changeset viewer.