Commit 9e931987 authored by Kirk Webb's avatar Kirk Webb

Add DB state for blockstore object composition.

Also add state for tracking individual object attributes.
parent 26e74c15
......@@ -134,6 +134,19 @@ CREATE TABLE `blobs` (
PRIMARY KEY (`uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `blockstore_attributes`
--
DROP TABLE IF EXISTS `blockstore_attributes`;
CREATE TABLE `blockstore_attributes` (
`bsidx` int(10) unsigned NOT NULL,
`attrkey` varchar(32) NOT NULL default '',
`attrvalue` tinytext NOT NULL,
`attrtype` enum('integer','float','boolean','string') default 'string',
PRIMARY KEY (`bsidx`,`attrkey`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `blockstore_state`
--
......@@ -149,6 +162,18 @@ CREATE TABLE `blockstore_state` (
UNIQUE KEY nidbid (`node_id`,`bs_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `blockstore_trees`
--
DROP TABLE IF EXISTS `blockstore_trees`;
CREATE TABLE `blockstore_trees` (
`bsidx` int(10) unsigned NOT NULL,
`aggidx` int(10) unsigned NOT NULL default '0',
`hint` tinytext NOT NULL,
PRIMARY KEY (`bsidx`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `blockstore_type_attributes`
--
......@@ -172,7 +197,7 @@ CREATE TABLE `blockstores` (
`node_id` varchar(32) NOT NULL default '',
`bs_id` varchar(32) NOT NULL default '',
`type` varchar(30) NOT NULL default '',
`role` enum('infra','unused') NOT NULL default 'unused',
`role` enum('element','compound') NOT NULL default 'element',
`total_size` int(10) unsigned NOT NULL default '0',
`inception` datetime default NULL,
PRIMARY KEY (`bsidx`),
......
#
# Add DB schema for tracking storage object composition and individual object
# attributes.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBTableExists("blockstore_trees")) {
DBQueryFatal("CREATE TABLE `blockstore_trees` (".
" `bsidx` int(10) unsigned NOT NULL,".
" `aggidx` int(10) unsigned NOT NULL default 0,".
" `hint` tinytext NOT NULL default '',".
" PRIMARY KEY (`bsidx`)".
") ENGINE=MyISAM DEFAULT CHARSET=latin1");
}
if (!DBTableExists("blockstore_attributes")) {
DBQueryFatal("CREATE TABLE `blockstore_attributes` (".
" `bsidx` int(10) unsigned NOT NULL,".
" `attrkey` varchar(32) NOT NULL default '',".
" `attrvalue` tinytext NOT NULL,".
" `attrtype` enum('integer','float','boolean','string') default 'string',".
" PRIMARY KEY (`bsidx`,`attrkey`)".
") ENGINE=MyISAM DEFAULT CHARSET=latin1");
}
if (DBSlotExists("blockstores", "role")) {
DBQueryFatal("alter table blockstores change role role " .
" enum('element','compound') " .
" NOT NULL default 'element'");
}
return 0;
}
1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment