Commit e6644faa authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

A few more minor changes. Change exitcode to signed since in mysql, -1

is not a string of bits, but really 0 when the type is unsigned.
Sheesh. Add link from testbed_stats to experiment_resources to get
better info in showstats.
parent cc1ebcee
......@@ -3345,8 +3345,8 @@ sub GatherSwapStats($$$$$;$)
#
logit:
DBQueryWarn("insert into testbed_stats ".
"(idx, tstamp, exptidx, action, exitcode) ".
"values (0, now(), $exptidx, '$mode', $ecode)");
"(idx, tstamp, exptidx, rsrcidx, action, exitcode) ".
"values (0, now(), $exptidx, $rsrcidx, '$mode', $ecode)");
}
#
......
......@@ -1130,8 +1130,9 @@ CREATE TABLE testbed_stats (
idx int(10) unsigned NOT NULL auto_increment,
tstamp datetime default NULL,
exptidx int(10) unsigned NOT NULL default '0',
rsrcidx int(10) unsigned NOT NULL default '0',
action varchar(16) NOT NULL default '',
exitcode tinyint(3) unsigned default '0',
exitcode tinyint(3) default '0',
PRIMARY KEY (idx)
) TYPE=MyISAM;
......
......@@ -516,3 +516,31 @@ last_net_act,last_cpu_act,last_ext_act);
DBQueryFatal("update experiment_stats set rsrcidx=$idx ".
"where exptidx=$exptidx");
}
1.144: Add link from testbed_stats to the experiment_resources record
that was active at the time of the operation. This makes it
possible for showstats.php3 to act like a log file, since we
have the info that corresponds at that time (rather than just
the most recent). Also a minor bug fix for exitcode, which
should not be unsigned.
alter table testbed_stats change exitcode exitcode
tinyint(3) default '0';
alter table testbed_stats add rsrcidx
int(10) unsigned NOT NULL default '0' after exptidx;
my $query_result =
DBQueryFatal("select t.idx,t.exptidx,s.rsrcidx ".
" from testbed_stats as t ".
"left join experiment_stats as s ".
" on s.exptidx=t.exptidx");
while (($idx,$exptidx,$rsrcidx) = $query_result->fetchrow_array()) {
if (!defined($rsrcidx)) {
print STDERR "No rsrcidx for $idx ($exptidx)\n";
next;
}
print "update testbed_stats set rsrcidx=$rsrcidx ".
"where idx=$idx;\n";
}
......@@ -151,7 +151,7 @@ $query_result =
DBQueryFatal("select s.*,t.*,r.*,t.idx as statno,t.tstamp as ttstamp ".
" from testbed_stats as t ".
"left join experiment_stats as s on s.exptidx=t.exptidx ".
"left join experiment_resources as r on r.idx=s.rsrcidx ".
"left join experiment_resources as r on r.idx=t.rsrcidx ".
"$wclause ".
"order by t.tstamp desc,t.idx desc limit $records");
......
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