IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20030


Ignore:
Timestamp:
Oct 9, 2008, 1:27:44 PM (18 years ago)
Author:
jhoblitt
Message:

change find_objects_with_unavailable_instances query to work on a temporary table instead of directly on the mountedvol table

Location:
trunk/Nebulous-Server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/Changes

    r20023 r20030  
    2323      level locks being set by a cursor
    2424    - drop instance.sha1sum and instance.assigned_vol_id
     25    - change find_objects_with_unavailable_instances query to work on a
     26      temporary table instead of directly on the mountedvol table
    2527
    26280.15 Thu Sep 11 13:00:59 HST 2008
  • trunk/Nebulous-Server/bin/neb-admin

    r19790 r20030  
    33# Copyright (C) 2005-2008  Joshua Hoblitt
    44#
    5 # $Id: neb-admin,v 1.9 2008-09-30 21:55:44 jhoblitt Exp $
     5# $Id: neb-admin,v 1.10 2008-10-09 23:27:44 jhoblitt Exp $
    66
    77use strict;
     
    7070
    7171# so_id, ext_id, instances, available_instances, need_recovery, recoverable
     72{
     73    my $query = $dbh->prepare("CREATE TEMPORARY TABLE mymountedvol LIKE mountedvol");
     74    $query->execute;
     75}
     76
     77{
     78    my $query = $dbh->prepare("INSERT INTO mymountedvol SELECT * FROM mountedvol");
     79    $query->execute;
     80}
     81
    7282my $query = $dbh->prepare( $sql->find_objects_with_unavailable_instances
    7383        . " LIMIT $limit" );
    7484$query->execute;
     85
     86$dbh->do("DROP TABLE IF EXISTS mymountedvol");
    7587
    7688my @rows;
  • trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm

    r20023 r20030  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: SQL.pm,v 1.70 2008-10-09 21:30:10 jhoblitt Exp $
     3# $Id: SQL.pm,v 1.71 2008-10-09 23:27:44 jhoblitt Exp $
    44
    55package Nebulous::Server::SQL;
     
    293293            volume.name as volume_name,
    294294            volume.host as volume_host,
    295             count(mountedvol.vol_id) as available_instances,
    296             count(mountedvol.vol_id) > 0 as recoverable,
     295            count(mymountedvol.vol_id) as available_instances,
     296            count(mymountedvol.vol_id) > 0 as recoverable,
    297297            storage_object_xattr.value as copies
    298298        FROM storage_object
     
    303303        LEFT JOIN storage_object_xattr
    304304            ON storage_object.so_id = storage_object_xattr.so_id
    305         JOIN mountedvol
     305        JOIN mymountedvol
    306306            USING(vol_id)
    307         WHERE mountedvol.available = 1
     307        WHERE mymountedvol.available = 1
    308308--        WHERE storage_object_xattr.name = 'user.copies'
    309309        GROUP BY so_id
Note: See TracChangeset for help on using the changeset viewer.