Changeset 24637 for trunk/Nebulous-Server/lib/Nebulous/Server.pm
- Timestamp:
- Jul 1, 2009, 5:21:32 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous-Server/lib/Nebulous/Server.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/lib/Nebulous/Server.pm
r24607 r24637 56 56 my ($config) = @_; 57 57 58 # log4perl is not ava liable until we call init()58 # log4perl is not available until we call init() 59 59 Nebulous::Server::Log->init($config); 60 60 my $log = Log::Log4perl::get_logger( "Nebulous::Server" ); … … 1622 1622 TRANS: while (1) { 1623 1623 eval { 1624 my $instances; 1624 my $total; 1625 my $available; 1625 1626 my $so_id; 1626 1627 my $ins_id; … … 1636 1637 my $record = $query->fetchrow_hashref; 1637 1638 $so_id = $record->{ 'so_id' }; 1638 $instances = $record->{ 'count(ins_id)' }; 1639 $total = $record->{ 'total' }; 1640 $available = $record->{ 'available' }; 1639 1641 $query->finish; 1640 1642 } … … 1664 1666 die( "affected row count is $rows instead of 1" ); 1665 1667 } 1666 } 1667 1668 # if we just deleted the last instance associated with a storage object 1669 # remove it too 1670 if ( $instances == 1 ) { 1668 1669 } 1670 1671 # if we just deleted the last 'available' instance associated with 1672 # a storage object remove it too 1673 if ( $available == 1 ) { 1671 1674 # remove key from cache 1672 1675 $self->cache->delete($key->path) if defined $self->cache; 1673 1676 1674 # we just removed the last instance 1677 # record the path of the innaccesible files for deferred 1678 # deletion 1679 { 1680 my $query = $db->prepare_cached( $sql->copy_instances_to_deleted ); 1681 $query->execute( $so_id ); 1682 } 1683 # remove all instances... not strictly nessicary as the delete 1684 # from storage_object should cascade but the fkey was specified 1685 # without the cascade 1686 { 1687 my $query = $db->prepare_cached( $sql->delete_instance_by_so_id ); 1688 $query->execute( $so_id ); 1689 } 1690 1691 # delete the storage object, remaining instances should be 1692 # removed via cascading delete 1675 1693 my $query = $db->prepare_cached( $sql->delete_object ); 1676 1694 my $rows = $query->execute( $so_id );
Note:
See TracChangeset
for help on using the changeset viewer.
