Changeset 25027 for branches/pap/Nebulous-Server/bin/neb-admin
- Timestamp:
- Aug 7, 2009, 4:08:25 PM (17 years ago)
- Location:
- branches/pap
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
Nebulous-Server (modified) (1 prop)
-
Nebulous-Server/bin/neb-admin (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/Nebulous-Server
- Property svn:mergeinfo changed
-
branches/pap/Nebulous-Server/bin/neb-admin
r23932 r25027 91 91 { 92 92 # so_id, ext_id, instances, available_instances, need_recovery, recoverable 93 $dbh->do("CREATE TEMPORARY TABLE mymountedvol LIKE mountedvol"); 94 $dbh->do("INSERT INTO mymountedvol SELECT * FROM mountedvol"); 95 $dbh->do("CREATE TEMPORARY TABLE myvolume LIKE volume"); 96 $dbh->do("INSERT INTO myvolume SELECT * FROM volume"); 93 # XXX don't remove the temp table code -- testing w/o it 94 # $dbh->do("CREATE TEMPORARY TABLE mymountedvol LIKE mountedvol"); 95 # $dbh->do("INSERT INTO mymountedvol SELECT * FROM mountedvol"); 97 96 98 97 if (not defined $so_id_start) { $so_id_start = 0; } … … 102 101 # XXX check if so_id_start is beyond MAX(so_id): if so, exit with exit status 10 103 102 { 104 my $query = $dbh->prepare("SELECT MAX(so_id) from storage_object");105 $query->execute;103 my $query = $dbh->prepare("SELECT MAX(so_id) from storage_object"); 104 $query->execute; 106 105 my $answer = $query->fetchrow_arrayref; 107 106 my $max_so_id = $$answer[0]; 108 $query->finish;109 110 if ($so_id_start > $max_so_id) {111 print STDERR "at end of so_id range, reset please\n";112 exit 10;113 }114 } 115 107 $query->finish; 108 109 if ($so_id_start > $max_so_id) { 110 print STDERR "at end of so_id range, reset please\n"; 111 exit 10; 112 } 113 } 114 116 115 my $query = $dbh->prepare( 117 " SELECT118 storage_object.so_id,119 ext_id,120 count(ins_id) as instances,121 myvolume.name as volume_name,122 myvolume.host as volume_host,123 count(mymountedvol.vol_id) as available_instances,124 count(mymountedvol.vol_id) > 0 as recoverable,125 storage_object_xattr.value as copies126 FROM storage_object127 JOIN instance128 USING(so_id)129 JOIN myvolume130 USING(vol_id)131 LEFT JOIN storage_object_xattr132 ON storage_object.so_id = storage_object_xattr.so_id133 JOIN mymountedvol134 USING(vol_id)135 WHERE mymountedvol.available = 1136 AND storage_object_xattr.name = 'user.copies'137 AND s torage_object.so_id >= $so_id_start138 AND s torage_object.so_id < $so_id_end139 GROUP BY so_id140 HAVING available_instances < instances OR instances < copies141 LIMIT $limit"116 " 117 SELECT 118 so.so_id, 119 so.ext_id, 120 count(ins_id) as instances, 121 mv.name as volume_name, 122 mv.host as volume_host, 123 count(mv.vol_id) as available_instances, 124 count(mv.vol_id) > 0 as recoverable, 125 xattr.value as copies 126 FROM storage_object AS so 127 LEFT JOIN storage_object_xattr AS xattr 128 ON so.so_id = xattr.so_id 129 AND xattr.name = 'user.copies' 130 JOIN instance AS i 131 ON so.so_id = i.so_id 132 JOIN mountedvol AS mv 133 USING(vol_id) 134 WHERE 135 mv.available = 1 136 AND so.so_id >= $so_id_start 137 AND so.so_id < $so_id_end 138 GROUP BY so_id 139 HAVING available_instances < instances OR instances < copies 140 LIMIT $limit" 142 141 ); 143 142 $query->execute; 144 143 145 $dbh->do("DROP TABLE IF EXISTS mymountedvol");144 # $dbh->do("DROP TABLE IF EXISTS mymountedvol"); 146 145 147 146 my @rows; … … 174 173 # if the copies xattr is unset and the object has 2 or more instances, we 175 174 # will assume a target of 2 copies 176 177 # XXX change this: there should be no default value or we will178 # have a race condition. user.copies should never get set by179 # any client until AFTER a file is no longer in use.175 176 # XXX change this: there should be no default value or we will 177 # have a race condition. user.copies should never get set by 178 # any client until AFTER a file is no longer in use. 180 179 my $copies = $obj->{copies} || 2; 181 180 … … 207 206 # use a different exit status if we hit the limit (likely more files pending) 208 207 if ($Npending == $limit) { 209 exit 1;208 exit 1; 210 209 } 211 210 exit 0; … … 225 224 226 225 $dbh->do("DROP TABLE IF EXISTS mymountedvol"); 226 $dbh->do("DROP TABLE IF EXISTS myvolume"); 227 227 228 228 my @rows;
Note:
See TracChangeset
for help on using the changeset viewer.
