Changeset 40314 for trunk/ippScripts/scripts/rawcheck_mddb.pl
- Timestamp:
- Jan 18, 2018, 3:59:12 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/rawcheck_mddb.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/rawcheck_mddb.pl
r40222 r40314 167 167 $down_volume{$name} = 1; 168 168 } 169 else { 170 $down_volume{$name} = 0; 171 } 169 172 170 173 if (($name =~ /ippb05/)||($name =~ /ippb02/)) { … … 262 265 263 266 # Get md database results for this exp_id/class_id 264 my $md_query = "select file_id,ins_id,mvol_name,site_name,file,disk_sum,(STRCMP(md5sum,disk_sum) = 0) AS is_valid FROM obj JOIN ins USING(file_id)JOIN vol USING(mvol_id) WHERE exp_id = $exp_id AND class_id = '${class_id}'";267 my $md_query = "select file_id,ins_id,mvol_name,site_name,file,disk_sum,(STRCMP(md5sum,disk_sum) = 0) AS is_valid FROM obj LEFT JOIN ins USING(file_id) LEFT JOIN vol USING(mvol_id) WHERE exp_id = $exp_id AND class_id = '${class_id}'"; 265 268 my $md_instances = $mddb->selectall_arrayref( $md_query ); 266 269 … … 270 273 foreach my $r (@{ $md_instances }) { 271 274 my ($file_id,$ins_id,$vol_name,$site_name,$f,$disk_sum,$is_valid) = @{ $r }; 272 $f =~ s%//%/%g; 273 unless (exists($unified_list{$f})) { 274 if (-e $f) { 275 $unified_list{$f}{exists} = 1; 276 } 277 else { 278 $unified_list{$f}{exists} = 0; 279 } 280 } 281 # This should only happen if the same scan was ingested twice. 282 # Be paranoid and refuse to cull if this is the case. 283 if (exists($unified_list{$f}{md_ins_id})) { 284 if (($file_id == $unified_list{$f}{md_file_id})&& 285 ($vol_name eq $unified_list{$f}{md_vol})&& 286 ($site_name eq $unified_list{$f}{md_site})&& 287 ($disk_sum eq $unified_list{$f}{disk_sum})&& 288 ($is_valid == $unified_list{$f}{is_valid})) { 289 print "#DUPLICATE INS: $ins_id have $unified_list{$f}{md_ins_id} already\n"; 290 mddb_delete_instance($mddb,$ins_id); 291 $do_cull = -1; 292 next; 293 } 294 else { 295 # The data is inconsistent. Make a human fix it. 296 print "INS ERROR: $f -> \n"; 297 print "\t($file_id $ins_id $vol_name $site_name $disk_sum $is_valid)\n"; 298 print "\t($unified_list{$f}{md_file_id} $unified_list{$f}{md_ins_id} $unified_list{$f}{md_vol} $unified_list{$f}{md_site} $unified_list{$f}{disk_sum} $unified_list{$f}{is_valid})\n"; 299 die; 300 } 301 } 302 303 $unified_list{$f}{md_file_id} = $file_id; 304 $unified_list{$f}{md_ins_id} = $ins_id; 305 $unified_list{$f}{md_vol} = $vol_name; 306 $unified_list{$f}{md_site} = $site_name; 307 $unified_list{$f}{disk_sum} = $disk_sum; 308 $unified_list{$f}{is_valid} = $is_valid; 309 310 if ($md_file_id == -1) { 311 $md_file_id = $file_id; 312 } 313 elsif ($file_id != $md_file_id) { 314 die "Instance $ins_id has bad file_id $file_id expected $md_file_id"; 275 276 if ((defined($f))&&(defined($ins_id))) { 277 $f =~ s%//%/%g; 278 unless (exists($unified_list{$f})) { 279 if (-e $f) { 280 $unified_list{$f}{exists} = 1; 281 } 282 else { 283 $unified_list{$f}{exists} = 0; 284 } 285 } 286 # This should only happen if the same scan was ingested twice. 287 # Be paranoid and refuse to cull if this is the case. 288 if (exists($unified_list{$f}{md_ins_id})) { 289 if (($file_id == $unified_list{$f}{md_file_id})&& 290 ($vol_name eq $unified_list{$f}{md_vol})&& 291 ($site_name eq $unified_list{$f}{md_site})&& 292 ($disk_sum eq $unified_list{$f}{disk_sum})&& 293 ($is_valid == $unified_list{$f}{is_valid})) { 294 print "#DUPLICATE INS: $ins_id have $unified_list{$f}{md_ins_id} already\n"; 295 mddb_delete_instance($mddb,$ins_id); 296 $do_cull = -1; 297 next; 298 } 299 else { 300 # The data is inconsistent. Make a human fix it. 301 print "INS ERROR: $f -> \n"; 302 print "\t($file_id $ins_id $vol_name $site_name $disk_sum $is_valid)\n"; 303 print "\t($unified_list{$f}{md_file_id} $unified_list{$f}{md_ins_id} $unified_list{$f}{md_vol} $unified_list{$f}{md_site} $unified_list{$f}{disk_sum} $unified_list{$f}{is_valid})\n"; 304 die; 305 } 306 } 307 308 $unified_list{$f}{md_file_id} = $file_id; 309 $unified_list{$f}{md_ins_id} = $ins_id; 310 $unified_list{$f}{md_vol} = $vol_name; 311 $unified_list{$f}{md_site} = $site_name; 312 $unified_list{$f}{disk_sum} = $disk_sum; 313 $unified_list{$f}{is_valid} = $is_valid; 314 } 315 316 if (defined($file_id)) { 317 if ($md_file_id == -1) { 318 $md_file_id = $file_id; 319 } 320 elsif ($file_id != $md_file_id) { 321 die "Instance $ins_id has bad file_id $file_id expected $md_file_id"; 322 } 315 323 } 316 324 }
Note:
See TracChangeset
for help on using the changeset viewer.
