Changeset 17072 for trunk/Nebulous-Server/bin/neb-fsck
- Timestamp:
- Mar 20, 2008, 11:13:28 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous-Server/bin/neb-fsck (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/bin/neb-fsck
r16264 r17072 3 3 # Copyright (C) 2005-2008 Joshua Hoblitt 4 4 # 5 # $Id: neb-fsck,v 1. 1 2008-01-30 00:19:34jhoblitt Exp $5 # $Id: neb-fsck,v 1.2 2008-03-20 21:12:06 jhoblitt Exp $ 6 6 7 7 use strict; … … 59 59 my $sql = Nebulous::Server::SQL->new(); 60 60 61 print "Pass 1: Look for objects with inaccessable instances\n"; 62 61 63 # so_id, ext_id, instances, available_instances, need_recovery, recoverable 62 64 my $query = $dbh->prepare( $sql->find_objects_with_unavailable_instances ); … … 70 72 71 73 foreach my $obj (@rows) { 74 # use Data::Dumper; 75 # print Dumper($obj); 72 76 my $so_id = $obj->{so_id}; 73 77 my $key = $obj->{ext_id}; 74 78 my $has = $obj->{instances}; 75 my $available = $obj->{ instances_available};76 my $need = $obj->{need_recovery};79 my $available = $obj->{available_instances} || 0; 80 my $need_recovery = $obj->{need_recovery}; 77 81 my $recoverable = $obj->{recoverable}; 82 # if the copies xattr is unset and the object has 2 or more instances, we 83 # will assume a target of 2 copies 84 my $copies = $obj->{copies} || 2; 78 85 79 86 # objects with only a single instance that are offline are unrecoverable so 80 87 # we don't need to handle that special case 81 next unless $need ;88 next unless $need_recovery; 82 89 unless ($recoverable) { 83 90 warn "so_id: $so_id key: \'$key\' ", … … 86 93 } 87 94 88 $available ||= 0; 89 next unless $available < 2; 90 91 warn "so_id: $so_id key: \'$key\' ", 92 " has only 1 instance avaiable -- replicating"; 93 94 $neb->replicate($obj->{ext_id}) 95 or warn "so_id: $so_id key: \'$key\' failed to replicate"; 95 my $need = $copies - $available; 96 $need = 0 if $need < 0; 97 98 next unless $need; 99 100 for (; $need > 0; $need--) { 101 warn "so_id: $so_id key: \'$key\' ", 102 "has $available available instances, target $copies -- replicating"; 103 $neb->replicate($obj->{ext_id}) 104 or warn "so_id: $so_id key: \'$key\' replication failed"; 105 106 $available++; 107 } 96 108 } 109 110 print "Pass 2: Check volumes for files without an instance\n"; 111 112 # get a list of volumes and their paths 113 # get a list of all instances on a volume 114 # get a list of all files under the volumes path 115 # compare the two lists 97 116 98 117 __END__
Note:
See TracChangeset
for help on using the changeset viewer.
