Commit e8aacb26 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Rename card,port in port_counters and change the primary key to iface.

Another nail in the card,port coffin.
parent e90ee1e6
......@@ -4204,8 +4204,8 @@ CREATE TABLE `plab_slices` (
DROP TABLE IF EXISTS `port_counters`;
CREATE TABLE `port_counters` (
`node_id` char(32) NOT NULL default '',
`card` tinyint(3) unsigned NOT NULL default '0',
`port` smallint(5) unsigned NOT NULL default '0',
`card_saved` tinyint(3) unsigned NOT NULL default '0',
`port_saved` smallint(5) unsigned NOT NULL default '0',
`iface` text NOT NULL,
`ifInOctets` int(10) unsigned NOT NULL default '0',
`ifInUcastPkts` int(10) unsigned NOT NULL default '0',
......@@ -4219,7 +4219,7 @@ CREATE TABLE `port_counters` (
`ifOutDiscards` int(10) unsigned NOT NULL default '0',
`ifOutErrors` int(10) unsigned NOT NULL default '0',
`ifOutQLen` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`node_id`,`card`,`port`)
PRIMARY KEY (`node_id`,`iface`(128))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
......
#
# Update port_counters, no more card,port
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (DBKeyExists("port_counters", "PRIMARY")) {
DBQueryFatal("alter table port_counters drop primary key");
}
if (DBSlotExists("port_counters", "card")) {
DBQueryFatal("alter table port_counters ".
" change card card_saved ".
" tinyint(3) unsigned NOT NULL default '0',".
" change port port_saved ".
" smallint(5) unsigned NOT NULL default '0'");
}
# These get left behind.
DBQueryFatal("delete from port_counters where iface=''");
if (!DBKeyExists("port_counters", "PRIMARY")) {
DBQueryFatal("alter table port_counters add primary key ".
" (`node_id`,`iface`(128))");
}
return 0;
}
1;
# Local Variables:
# mode:perl
# End:
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