IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23345


Ignore:
Timestamp:
Mar 17, 2009, 11:08:44 AM (17 years ago)
Author:
eugene
Message:

add so_id_start and so_id_range to neb-admin pendingreplicate and replicate task

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/bin/neb-admin

    r20202 r23345  
    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
  • trunk/ippTasks/replicate.pro

    r23230 r23345  
    6262# the replicate process interacts with only the single Nebulous server
    6363
     64# Each 'pendingreplicate' query is limited to a finite number of so_id values. 
     65# Each time we call replicate.load, we increment SO_ID_START by the range value. 
     66# If the pendingreplicate query exits with exit status 10, we start over at 0
     67
     68$SO_ID_START = 0
     69$SO_ID_RANGE = 100000
     70
    6471# select Nebulous objects which desire additional copies
    6572task           replicate.load
     
    6875  # modify these after the tasks are tested
    6976  periods      -poll 10
    70   periods      -exec 1
     77  periods      -exec 10
    7178  periods      -timeout 1500
    7279  npending     1
     
    7986      # command does not need to be dynamic, but having it so allows us to adjust the periods
    8087      # so that we dont have to wait 10 minutes for things to start up
    81       command neb-admin --host $NEB_HOST --db $NEB_DB --user $NEB_USER --pass $NEB_PASS --pendingreplicate --limit 7500
     88      # XXX smaller limited?  7500 will be a huge book of things to do...
     89      command neb-admin --host $NEB_HOST --db $NEB_DB --user $NEB_USER --pass $NEB_PASS --pendingreplicate --limit 7500 --so_id_start $SO_ID_START --so_id_range $SO_ID_RANGE
    8290      periods      -exec 1800
    8391
     
    8694  # success
    8795  task.exit $EXIT_SUCCESS
     96    # advance the so_id counter
     97    $SO_ID_START += $SO_ID_RANGE
     98
    8899    # convert 'stdout' to book format
    89100    ipptool2book stdout replicatePending -key key -uniq -setword pantaskState INIT
     
    95106    # delete existing entries in the appropriate pantaskStates
    96107    process_cleanup replicatePending
     108  end
     109
     110  # out of so_id range, reset
     111  task.exit 10
     112    # advance the so_id counter
     113    $SO_ID_START = 0
    97114  end
    98115
Note: See TracChangeset for help on using the changeset viewer.