IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 4, 2007, 1:36:46 PM (19 years ago)
Author:
jhoblitt
Message:

rework the getmountedvol() stored procedure to attempt to work around what appears to be some nasty transacational isolation leak throught that was causing getmountedvol() to randomly hang when nebdiskd changed the mount table.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/bin/nebdiskd

    r13023 r13251  
    33# Copyright (C) 2007  Joshua Hoblitt
    44#
    5 # $Id: nebdiskd,v 1.3 2007-04-25 19:52:49 jhoblitt Exp $
     5# $Id: nebdiskd,v 1.4 2007-05-04 23:36:46 jhoblitt Exp $
    66
    77use strict;
     
    9898        stat_dirs($mounts);
    9999
    100         my $query = $dbh->prepare_cached("INSERT INTO mount VALUES(?, ?, ?)");
    101         $dbh->do("DELETE FROM mount");
    102         print "flushed mount table\n" if $debug;
    103 
    104         my $stats = $lxs->get;
    105         foreach my $dev (keys %$stats) {
    106             my $mnt = $stats->{$dev};
    107             my %mount;
    108             $query->execute(@$mnt{qw( mountpoint total usage )});
    109             print "adding $mnt->{mountpoint} to db\n" if $debug;
     100        eval {
     101            my $query = $dbh->prepare_cached("INSERT INTO mount VALUES(?, ?, ?)");
     102            $dbh->do("DELETE FROM mount");
     103
     104            print "flushed mount table\n" if $debug;
     105
     106            my $stats = $lxs->get;
     107            foreach my $dev (keys %$stats) {
     108                my $mnt = $stats->{$dev};
     109                my %mount;
     110                $query->execute(@$mnt{qw( mountpoint total usage )});
     111                print "adding $mnt->{mountpoint} to db\n" if $debug;
     112            }
     113
     114            $dbh->do("call getmountedvol()");
     115
     116            $dbh->commit;
     117        };
     118        if ($@) {
     119            $db->rollback;
     120            warn $@;
    110121        }
    111 
    112         $dbh->commit;
    113122
    114123        sleep $poll_interval;
     
    155164    );
    156165
    157     $dbh->do( $sql->set_transaction_model );
    158     $dbh->commit;
     166    eval {
     167        $dbh->do( $sql->set_transaction_model );
     168        $dbh->commit;
     169    };
     170    if ($@) {
     171        $db->rollback;
     172        die $@;
     173    }
    159174
    160175    return $dbh;
Note: See TracChangeset for help on using the changeset viewer.