Changeset 5487
- Timestamp:
- Nov 8, 2005, 2:48:24 PM (21 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
Nebulous-Server/lib/Nebulous/Server.pm (modified) (2 diffs)
-
Nebulous-Server/lib/Nebulous/Server/SQL.pm (modified) (6 diffs)
-
Nebulous/lib/Nebulous/Server.pm (modified) (2 diffs)
-
Nebulous/lib/Nebulous/Server/SQL.pm (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/lib/Nebulous/Server.pm
r5478 r5487 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Server.pm,v 1.1 1 2005-11-05 02:35:45jhoblitt Exp $3 # $Id: Server.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server; … … 590 590 my $rows = $query->execute( $so_id ); 591 591 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" ); 595 597 } 596 598 } -
trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
r5481 r5487 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: SQL.pm,v 1.1 1 2005-11-05 03:26:07jhoblitt Exp $3 # $Id: SQL.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server::SQL; … … 24 24 new_object => qq{ 25 25 INSERT INTO storage_object 26 (so_id, ext_id )27 VALUES (?, ? )26 (so_id, ext_id, type) 27 VALUES (?, ?, 'REG_FILE') 28 28 }, 29 29 new_object_attr => qq{ … … 33 33 }, 34 34 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 = ? 37 39 }, 38 40 new_object_instance => qq{ … … 52 54 WHERE ext_id = ? 53 55 }, 56 # Note: this sets an update lock 54 57 get_object_locks => qq{ 55 58 SELECT storage_object.so_id, … … 139 142 my @clear = split /;/, <<END; 140 143 DROP TABLE IF EXISTS storage_object; 144 DROP TABLE IF EXISTS storage_object_attr; 141 145 DROP TABLE IF EXISTS instance; 142 146 DROP TABLE IF EXISTS lock_record; … … 163 167 164 168 __DATA__ 165 DROP TABLE IF EXISTS storage_object;166 169 CREATE TABLE storage_object ( 167 170 so_id BIGINT NOT NULL AUTO_INCREMENT, 168 171 ext_id VARCHAR(255) BINARY NOT NULL UNIQUE, 172 type enum('REG_FILE'), 169 173 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 174 178 CREATE TABLE storage_object_attr ( 175 179 so_id BIGINT NOT NULL AUTO_INCREMENT, -
trunk/Nebulous/lib/Nebulous/Server.pm
r5478 r5487 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Server.pm,v 1.1 1 2005-11-05 02:35:45jhoblitt Exp $3 # $Id: Server.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server; … … 590 590 my $rows = $query->execute( $so_id ); 591 591 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" ); 595 597 } 596 598 } -
trunk/Nebulous/lib/Nebulous/Server/SQL.pm
r5481 r5487 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: SQL.pm,v 1.1 1 2005-11-05 03:26:07jhoblitt Exp $3 # $Id: SQL.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $ 4 4 5 5 package Nebulous::Server::SQL; … … 24 24 new_object => qq{ 25 25 INSERT INTO storage_object 26 (so_id, ext_id )27 VALUES (?, ? )26 (so_id, ext_id, type) 27 VALUES (?, ?, 'REG_FILE') 28 28 }, 29 29 new_object_attr => qq{ … … 33 33 }, 34 34 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 = ? 37 39 }, 38 40 new_object_instance => qq{ … … 52 54 WHERE ext_id = ? 53 55 }, 56 # Note: this sets an update lock 54 57 get_object_locks => qq{ 55 58 SELECT storage_object.so_id, … … 139 142 my @clear = split /;/, <<END; 140 143 DROP TABLE IF EXISTS storage_object; 144 DROP TABLE IF EXISTS storage_object_attr; 141 145 DROP TABLE IF EXISTS instance; 142 146 DROP TABLE IF EXISTS lock_record; … … 163 167 164 168 __DATA__ 165 DROP TABLE IF EXISTS storage_object;166 169 CREATE TABLE storage_object ( 167 170 so_id BIGINT NOT NULL AUTO_INCREMENT, 168 171 ext_id VARCHAR(255) BINARY NOT NULL UNIQUE, 172 type enum('REG_FILE'), 169 173 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 174 178 CREATE TABLE storage_object_attr ( 175 179 so_id BIGINT NOT NULL AUTO_INCREMENT,
Note:
See TracChangeset
for help on using the changeset viewer.
