- Timestamp:
- Dec 14, 2008, 12:52:37 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/neb_distrib_20081210/Nebulous-Server/lib/Nebulous/Server/SQL.pm
r20175 r20989 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: SQL.pm,v 1.75 2008-10-15 20:45:51 jhoblittExp $3 # $Id: SQL.pm,v 1.75.6.1 2008-12-14 22:52:37 eugene Exp $ 4 4 5 5 package Nebulous::Server::SQL; … … 8 8 use warnings FATAL => qw( all ); 9 9 10 our $VERSION = '0.0 2';10 our $VERSION = '0.03'; 11 11 12 12 use base qw( Class::Accessor::Fast ); … … 47 47 (so_id, vol_id, uri) 48 48 VALUES (?, ?, 'error') 49 }, 50 get_all_instances => qq{ 51 SELECT * FROM INSTANCE 52 WHERE so_id = ? 49 53 }, 50 54 get_object => qq{ … … 324 328 HAVING available_instances < instances OR instances < copies 325 329 }, 326 find_objects_with_extra_instances => qq{327 SELECT 328 s torage_object.so_id,329 ext_id,330 find_objects_with_extra_instances_by_xattr => qq{ 331 SELECT 332 so.so_id, 333 so.ext_id, 330 334 count(ins_id) as instances, 331 volume.name as volume_name, 332 volume.host as volume_host, 333 count(mymountedvol.vol_id) as available_instances, 334 count(mymountedvol.vol_id) > 0 as recoverable, 335 storage_object_xattr.value as copies 336 FROM storage_object 337 JOIN instance 338 USING(so_id) 339 JOIN volume 340 USING(vol_id) 341 LEFT JOIN storage_object_xattr 342 ON storage_object.so_id = storage_object_xattr.so_id 343 JOIN mymountedvol 335 mv.name as volume_name, 336 mv.host as volume_host, 337 count(mv.vol_id) as available_instances, 338 xattr.value as copies 339 FROM storage_object AS so 340 JOIN storage_object_xattr as xattr 341 ON so.so_id = xattr.so_id 342 AND xattr.name = 'user.copies' 343 JOIN instance AS i 344 ON so.so_id = i.so_id 345 JOIN mountedvol AS mv 344 346 USING(vol_id) 345 347 WHERE 346 mymountedvol.available = 1 347 AND storage_object_xattr.name = 'user.copies' 348 mv.available = 1 348 349 GROUP BY so_id 349 350 HAVING available_instances > copies 351 limit 5; 350 352 }, 351 353 get_mounted_volumes => qq{
Note:
See TracChangeset
for help on using the changeset viewer.
