Changeset 23455
- Timestamp:
- Mar 20, 2009, 10:23:10 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous-Server/lib/Nebulous/Server.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/lib/Nebulous/Server.pm
r20990 r23455 269 269 $newkey = parse_neb_key($newkey); 270 270 271 eval { 272 # rename storage_object 273 my $query = $db->prepare_cached($sql->rename_object); 274 # this SQL statment takes the new key name as the first param 275 my $rows = $query->execute($newkey->path, $key->path); 276 277 # if we affected more then one row something very bad has happened. 278 unless ($rows == 1) { 279 $query->finish; 280 $log->logdie("affected row count is $rows instead of 1"); 281 } 282 283 $db->commit; 284 $log->debug("commit"); 285 }; 286 if ($@) { 287 $db->rollback; 288 $log->debug("rollback"); 289 $log->logdie("database error: $@"); 290 } 271 TRANS: do { 272 eval { 273 # rename storage_object 274 my $query = $db->prepare_cached($sql->rename_object); 275 # this SQL statment takes the new key name as the first param 276 my $rows = $query->execute($newkey->path, $key->path); 277 278 # if we affected more then one row something very bad has happened. 279 unless ($rows == 1) { 280 $query->finish; 281 $log->logdie("affected row count is $rows instead of 1"); 282 } 283 284 $db->commit; 285 $log->debug("commit"); 286 }; 287 if ($@) { 288 $db->rollback; 289 $log->debug("rollback"); 290 if ($@ =~ /Deadlock found/) { 291 $log->warn("database deadlock retrying transaction: $@"); 292 redo; 293 } 294 $log->logdie("database error: $@"); 295 } 296 } while $@; 291 297 292 298 $log->debug("leaving");
Note:
See TracChangeset
for help on using the changeset viewer.
