IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5487


Ignore:
Timestamp:
Nov 8, 2005, 2:48:24 PM (21 years ago)
Author:
jhoblitt
Message:

add type to storage_object
fix delete_object sql

Location:
trunk
Files:
4 edited

Legend:

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

    r5478 r5487  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.11 2005-11-05 02:35:45 jhoblitt Exp $
     3# $Id: Server.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    590590            my $rows = $query->execute( $so_id );
    591591
    592             # if we affected something other then one row something very bad has happened
    593             unless ( $rows == 1 ) {
    594                 $log->logdie( "affected row count is $rows instead of 1" );
     592            # if we affected something other then two rows something very bad
     593            # has happened
     594            # this will have to be changed in order to support hardlinks
     595            unless ( $rows == 2 ) {
     596                $log->logdie( "affected row count is $rows instead of 2" );
    595597            }
    596598        }
  • trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm

    r5481 r5487  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: SQL.pm,v 1.11 2005-11-05 03:26:07 jhoblitt Exp $
     3# $Id: SQL.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $
    44
    55package Nebulous::Server::SQL;
     
    2424    new_object          => qq{
    2525        INSERT INTO storage_object
    26         (so_id, ext_id)
    27         VALUES (?, ?)
     26        (so_id, ext_id, type)
     27        VALUES (?, ?, 'REG_FILE')
    2828    },
    2929    new_object_attr  => qq{
     
    3333    },
    3434    delete_object       => qq{
    35         DELETE FROM storage_object, storage_object_attr
    36         WHERE so_id = ?
     35        DELETE storage_object, storage_object_attr
     36        FROM storage_object LEFT JOIN storage_object_attr
     37        USING (so_id)
     38        WHERE storage_object.so_id = ?
    3739    },
    3840    new_object_instance  => qq{
     
    5254        WHERE ext_id = ?
    5355    },
     56    # Note: this sets an update lock
    5457    get_object_locks    => qq{
    5558        SELECT storage_object.so_id,
     
    139142    my @clear = split /;/, <<END;
    140143DROP TABLE IF EXISTS storage_object;
     144DROP TABLE IF EXISTS storage_object_attr;
    141145DROP TABLE IF EXISTS instance;
    142146DROP TABLE IF EXISTS lock_record;
     
    163167
    164168__DATA__
    165 DROP TABLE IF EXISTS storage_object;
    166169CREATE TABLE storage_object (
    167170    so_id BIGINT NOT NULL AUTO_INCREMENT,
    168171    ext_id VARCHAR(255) BINARY NOT NULL UNIQUE,
     172    type enum('REG_FILE'),
    169173    PRIMARY KEY(so_id),
    170     KEY(ext_id(64))
    171 ) ENGINE=innodb;
    172 
    173 DROP TABLE IF EXISTS storage_object_attr ;
     174    KEY(ext_id(64)),
     175    KEY(type)
     176) ENGINE=innodb;
     177
    174178CREATE TABLE storage_object_attr (
    175179    so_id BIGINT NOT NULL AUTO_INCREMENT,
  • trunk/Nebulous/lib/Nebulous/Server.pm

    r5478 r5487  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: Server.pm,v 1.11 2005-11-05 02:35:45 jhoblitt Exp $
     3# $Id: Server.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $
    44
    55package Nebulous::Server;
     
    590590            my $rows = $query->execute( $so_id );
    591591
    592             # if we affected something other then one row something very bad has happened
    593             unless ( $rows == 1 ) {
    594                 $log->logdie( "affected row count is $rows instead of 1" );
     592            # if we affected something other then two rows something very bad
     593            # has happened
     594            # this will have to be changed in order to support hardlinks
     595            unless ( $rows == 2 ) {
     596                $log->logdie( "affected row count is $rows instead of 2" );
    595597            }
    596598        }
  • trunk/Nebulous/lib/Nebulous/Server/SQL.pm

    r5481 r5487  
    11# Copyright (c) 2004  Joshua Hoblitt
    22#
    3 # $Id: SQL.pm,v 1.11 2005-11-05 03:26:07 jhoblitt Exp $
     3# $Id: SQL.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $
    44
    55package Nebulous::Server::SQL;
     
    2424    new_object          => qq{
    2525        INSERT INTO storage_object
    26         (so_id, ext_id)
    27         VALUES (?, ?)
     26        (so_id, ext_id, type)
     27        VALUES (?, ?, 'REG_FILE')
    2828    },
    2929    new_object_attr  => qq{
     
    3333    },
    3434    delete_object       => qq{
    35         DELETE FROM storage_object, storage_object_attr
    36         WHERE so_id = ?
     35        DELETE storage_object, storage_object_attr
     36        FROM storage_object LEFT JOIN storage_object_attr
     37        USING (so_id)
     38        WHERE storage_object.so_id = ?
    3739    },
    3840    new_object_instance  => qq{
     
    5254        WHERE ext_id = ?
    5355    },
     56    # Note: this sets an update lock
    5457    get_object_locks    => qq{
    5558        SELECT storage_object.so_id,
     
    139142    my @clear = split /;/, <<END;
    140143DROP TABLE IF EXISTS storage_object;
     144DROP TABLE IF EXISTS storage_object_attr;
    141145DROP TABLE IF EXISTS instance;
    142146DROP TABLE IF EXISTS lock_record;
     
    163167
    164168__DATA__
    165 DROP TABLE IF EXISTS storage_object;
    166169CREATE TABLE storage_object (
    167170    so_id BIGINT NOT NULL AUTO_INCREMENT,
    168171    ext_id VARCHAR(255) BINARY NOT NULL UNIQUE,
     172    type enum('REG_FILE'),
    169173    PRIMARY KEY(so_id),
    170     KEY(ext_id(64))
    171 ) ENGINE=innodb;
    172 
    173 DROP TABLE IF EXISTS storage_object_attr ;
     174    KEY(ext_id(64)),
     175    KEY(type)
     176) ENGINE=innodb;
     177
    174178CREATE TABLE storage_object_attr (
    175179    so_id BIGINT NOT NULL AUTO_INCREMENT,
Note: See TracChangeset for help on using the changeset viewer.