- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
DataStoreServer/scripts/dsreg (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/DataStoreServer/scripts/dsreg
r24196 r27840 168 168 169 169 if (!$prod_id) { 170 die("product $product not found\n"); 170 print STDERR "product '$product' not found\n"; 171 if ($force) { 172 exit(0); 173 } else { 174 exit(1); 175 } 171 176 } 172 177 $stmt = $dbh->prepare("SELECT fileset_id,fileset_name FROM dsFileset" . … … 188 193 my $fileset_id = $fs_row->{fileset_id}; 189 194 195 my $rows_affected; 190 196 eval { 191 197 $dbh->do("DELETE from dsFile where fileset_id = $fileset_id"); 192 $ dbh->do("DELETE from dsFileset where fileset_id = $fileset_id");198 $rows_affected = $dbh->do("DELETE from dsFileset where fileset_id = $fileset_id"); 193 199 194 200 if ($old_last_fs eq $fs_row->{fileset_name}) { … … 203 209 $new_last_fs = $new_newest->{fileset_name}; 204 210 } else { 205 $new_last_fs = "none";211 $new_last_fs = undef; 206 212 } 207 213 $stmt->finish(); 208 $dbh->do("UPDATE dsProduct SET last_fs = \'$new_last_fs\' WHERE prod_id = $prod_id");214 $dbh->do("UPDATE dsProduct SET last_fs = ? WHERE prod_id = $prod_id", undef, ($new_last_fs)); 209 215 } 210 216 $dbh->commit(); 211 217 }; 212 if ( $@) { # an error occured218 if (!$rows_affected or $@) { # an error occured 213 219 print STDERR "transaction failed, rolling back error was:\n$@\n"; 214 220 # roll back within eval to prevent rollback failure from terminating the script 215 221 eval {$dbh->rollback();}; 216 cleanup();217 222 exit 1; 218 223 } … … 221 226 222 227 if ($remove) { 223 if (system "rm -r $fileset_dir") { 224 die("failed to remove $fileset_dir"); 228 my $rc; 229 if (($rc = system "rm -r $fileset_dir")) { 230 die("failed to remove $fileset_dir error code: $rc"); 225 231 } 226 232 } else { 227 # zap the index script233 # just zap the index script 228 234 unlink("$index_script_name"); 229 235 } … … 350 356 die "file $path not found"; 351 357 } 352 if (!$file->{bytes}) { 353 my @finfo = stat($path); 354 unless (@finfo) { 355 die ("can't stat $path"); 358 # get the size of the file 359 my @finfo = stat($path); 360 unless (@finfo) { 361 die ("can't stat $path"); 362 } 363 # if size was supplied make sure that it matches the actual 364 # size 365 if ($file->{bytes}) { 366 my $current_size = $finfo[7]; 367 if ($file->{bytes} != $current_size) { 368 die "size on disk: $current_size does not match supplied" 369 . " size: $file->{bytes} for $path"; 356 370 } 371 } else { 357 372 $file->{bytes} = $finfo[7]; 358 373 } … … 360 375 # Get MD5 sum 361 376 $file->{md5sum} = file_md5_hex($path); 377 die("failed to compute valid md5sum for $path") if !$file->{md5sum}; 362 378 } 363 379 }
Note:
See TracChangeset
for help on using the changeset viewer.
