IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 30, 2009, 1:54:49 PM (17 years ago)
Author:
watersc1
Message:

Nebulous: Implemented a number of bug fixes and modifications to

ensure no loss of data.

  • Each volume can now be associated into a cabinet, defining their physical arrangement.
  • File creation: new files without a specified volume are created on a random volume from a subset of the N least full.
  • Replication: file replication uses the same volume selection method, with the constraints that a copy not be automatically placed on the same volume as another, and that the first copy not be housed within the same volume.
  • Cull: instead of removing the first available instance, first attempt to remove an instance on the same volume as another, then attempt to remove an instance in the same cabinet as another, and then remove the first only if those fail.
  • Corrected bug that prevented the deletion of an object if it had more than one unavailable instance.
  • Fixed nebdiskd to synchronize between volume->mountedvol tables and to properly remove volumes that were no longer accessible.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm

    r24915 r26292  
    237237            storage_object.so_id,
    238238            uri,
    239             available
     239            mountedvol.available,
     240            vol_id,
     241            cab_id
    240242        FROM storage_object
    241243        JOIN instance
     
    243245        JOIN mountedvol
    244246            USING(vol_id)
    245         WHERE ext_id = ?
    246             AND available = ?
     247        JOIN volume
     248            USING(vol_id)
     249        WHERE ext_id = ?
     250            AND mountedvol.available = ?
    247251    },
    248252    get_object_instances_by_vol_name => qq{
    249253        SELECT
    250254            storage_object.so_id,
    251             uri
     255            uri,
     256            vol_id,
     257            cab_id
    252258        FROM storage_object
    253259        JOIN instance
     
    255261        JOIN mountedvol
    256262            USING(vol_id)
    257         WHERE ext_id = ?
    258             AND name = ?
    259             AND available = ?
    260     },
     263        JOIN volume
     264            USING(vol_id)
     265        WHERE ext_id = ?
     266            AND mountedvol.name = ?
     267            AND mountedvol.available = ?
     268    },
     269    # volume handler
    261270    get_storage_volume_by_name   => qq{
    262271        SELECT
     
    275284        LIMIT 1
    276285    },
    277     get_replication_volume_for_ext_id   => qq{
     286    # volume handler
     287    get_cabinets_for_ext_id            => qq{
     288        SELECT DISTINCT
     289            cab_id
     290        FROM instance
     291        JOIN volume ON instance.vol_id = volume.vol_id
     292        JOIN storage_object USING(so_id)
     293        WHERE ext_id = ?
     294    },
     295    get_replication_volume_for_ext_id    => qq{
     296        SELECT * FROM (
    278297        SELECT
    279298            m.vol_id,
    280             host,
    281             path,
    282             xattr,
     299            m.host,
     300            m.path,
     301            m.xattr,
    283302            total - used as free
    284303        FROM mountedvol AS m
    285         LEFT JOIN instance AS i
     304        JOIN volume AS v USING(vol_id)
     305        LEFT JOIN (
     306                   SELECT
     307                       instance.vol_id,
     308                       so_id
     309                   FROM instance
     310                   JOIN volume
     311                   ON instance.vol_id = volume.vol_id
     312                  ) AS i
    286313            ON m.vol_id = i.vol_id
    287314            AND i.so_id = (
     
    290317                WHERE ext_id = ?
    291318            )
    292         WHERE
    293             i.vol_id IS NULL
    294             AND used / total < ?
    295             AND available = ?
    296             AND allocate = ?
    297             ORDER BY RAND()
    298             LIMIT 1
    299     },
     319         WHERE
     320             i.vol_id IS NULL
     321             AND used / total < ?
     322             AND m.available = ?
     323             AND m.allocate = ?
     324             AND ( (v.cab_id IS NULL) ||
     325                   (v.cab_id != ?) )
     326         ORDER BY free DESC
     327         LIMIT ?) as topfew
     328         ORDER BY RAND()
     329         LIMIT 1
     330    },
     331    # volume handler
    300332    get_storage_volume          => qq{
     333        SELECT * from (
    301334        SELECT
    302335            vol_id,
     
    311344            AND allocate = ?
    312345        ORDER BY free DESC
     346        LIMIT ?) as topfew
     347        ORDER BY RAND()
    313348        LIMIT 1
    314349    },
     350    new_cabinet         => qq{
     351        INSERT INTO cabinet (name, location, cab_id)
     352        VALUES (?, ?, NULL)
     353    },
    315354    new_volume          => qq{
    316         INSERT INTO volume (name, host, path, allocate, available, xattr, mountpoint)
    317         VALUES (?, ?, ?, TRUE, TRUE, FALSE, ?)
     355        INSERT INTO volume (name, host, path, allocate, available, xattr, mountpoint, cab_id)
     356        VALUES (?, ?, ?, TRUE, TRUE, FALSE, ?, NULL)
    318357    },
    319358    get_volume_by_name => qq{
     
    331370            v.available,
    332371            v.xattr,
    333             mountedvol.vol_id IS NOT NULL as mounted
     372            mountedvol.vol_id IS NOT NULL as mounted,
     373            v.cab_id
    334374        FROM volume AS v
    335375        LEFT JOIN mountedvol
     
    614654###
    615655
     656CREATE TABLE cabinet (
     657    cab_id INT NOT NULL AUTO_INCREMENT,
     658    name VARCHAR(255) NOT NULL,
     659    location VARCHAR(255),
     660    PRIMARY KEY(cab_id),
     661    UNIQUE KEY(name),
     662    KEY (location)
     663) ENGINE=innodb DEFAULT CHARSET=latin1;
     664
     665###
     666
    616667CREATE TABLE volume (
    617668    vol_id INT NOT NULL AUTO_INCREMENT,
     
    623674    xattr BOOLEAN DEFAULT FALSE,
    624675    mountpoint VARCHAR(255) NOT NULL,
     676    cab_id INT,
    625677    PRIMARY KEY(vol_id),
    626678    UNIQUE KEY(name),
     
    629681    KEY(allocate),
    630682    KEY(available),
     683    FOREIGN KEY(cab_id) REFERENCES cabinet(cab_id),
    631684    KEY(mountpoint(255))
    632685) ENGINE=innodb DEFAULT CHARSET=latin1;
Note: See TracChangeset for help on using the changeset viewer.