IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19959


Ignore:
Timestamp:
Oct 7, 2008, 11:53:21 AM (18 years ago)
Author:
jhoblitt
Message:

change getmountedvol() to use a view of the volume table to avoid table level locks being set by a cursor

Location:
trunk/Nebulous-Server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/Changes

    r19956 r19959  
    2020    - remove call to getmountedvol() stored proc from Nebulous::Server->mount()
    2121      as it's uneeded
     22    - change getmountedvol() to use a view of the volume table to avoid table
     23      level locks being set by a cursor
    2224
    23250.15 Thu Sep 11 13:00:59 HST 2008
  • trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm

    r19792 r19959  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: SQL.pm,v 1.65 2008-10-01 02:06:17 jhoblitt Exp $
     3# $Id: SQL.pm,v 1.66 2008-10-07 21:53:21 jhoblitt Exp $
    44
    55package Nebulous::Server::SQL;
     
    498498    DECLARE xattrvar BOOLEAN;
    499499    DECLARE trans_level VARCHAR(255);
    500     DECLARE cur1 CURSOR FOR SELECT vol_id, name, host, path, allocate, available, xattr FROM volume;
     500    DECLARE cur1 CURSOR FOR SELECT vol_id, name, host, path, allocate, available, xattr FROM v;
    501501    DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = TRUE;
    502502
     503    CREATE OR REPLACE ALGORITHM = TEMPTABLE VIEW v AS SELECT * FROM volume;
    503504    -- store the current transaction level
    504     SELECT @@session.tx_isolation INTO trans_level;
     505--    SELECT @@session.tx_isolation INTO trans_level;
    505506
    506507    -- set trans level to repeatable-read so the volume table does not change
    507508    -- out from under our cursor
    508     SET @@session.tx_isolation = 'REPEATABLE-READ';
     509--    SET @@session.tx_isolation = 'REPEATABLE-READ';
    509510
    510511    -- iterate over the volume table finding the coresponding entry in the
     
    531532
    532533    -- restore the original transaction level
    533     SET @@session.tx_isolation = trans_level;
    534 
     534--    SET @@session.tx_isolation = trans_level;
     535
     536    DROP VIEW v;
    535537    COMMIT;
    536538END
Note: See TracChangeset for help on using the changeset viewer.