IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 17, 2009, 12:08:50 PM (17 years ago)
Author:
beaumont
Message:

merged with head

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/Nebulous-Server/bin/neb-admin

    r20202 r23352  
    2323    $dbpass,
    2424    $dbuser,
     25    $so_id_start,
     26    $so_id_range,
    2527    $limit,
    2628    $pending,
     
    4143    'pendingreplicate|r'    => \$pending,
    4244    'pendingremoval'        => \$removal,
     45    'so_id_start=i'         => \$so_id_start,
     46    'so_id_range=i'         => \$so_id_range,
    4347    'limit|l=i'             => \$limit,
    4448    'verbose|v'             => \$verbose,
     
    5862
    5963# check to make sure that only one instance of neb-admin is running
     64# XXX this implies we should move pending replicate elsewhere
    6065my $pidfile = '/var/tmp/neb-admin';
    6166# abort if an instance is already running
     
    9196    $dbh->do("INSERT INTO myvolume SELECT * FROM volume");
    9297
     98    if (not defined $so_id_start) { $so_id_start = 0; }
     99    if (not defined $so_id_range) { $so_id_range = 100000; }
     100    my $so_id_end = $so_id_start + $so_id_range;
     101
     102    # XXX check if so_id_start is beyond MAX(so_id): if so, exit with exit status 10
     103    {
     104        my $query = $dbh->prepare("SELECT MAX(so_id) from storage_object");
     105        $query->execute;
     106        my $answer = $query->fetchrow_arrayref;
     107        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       
    93116    my $query = $dbh->prepare(
    94117    "        SELECT
     
    111134                USING(vol_id)
    112135            WHERE mymountedvol.available = 1
    113     --        WHERE storage_object_xattr.name = 'user.copies'
     136            AND storage_object_xattr.name = 'user.copies'
     137            AND storage_object.so_id >= $so_id_start
     138            AND storage_object.so_id <  $so_id_end
    114139            GROUP BY so_id
    115140            HAVING available_instances < instances OR instances < copies
Note: See TracChangeset for help on using the changeset viewer.