Commit eda71c58 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add a last_activity field to user_stats table, and set that from libdb

where we insert the testbed_stats record. This will make it much much faster
to generate the recent users list in genelists (currently taking 3 seconds!).
parent 34cada47
......@@ -4711,6 +4711,7 @@ sub GatherSwapStats($$$$$;$)
" action, exitcode) ".
"values (0, '$uid', $starttime, now(), $exptidx, $rsrcidx, ".
" '$mode', $ecode)");
DBQueryWarn("update user_stats set last_activity=now() where uid='$uid'");
}
#
......
......@@ -1855,6 +1855,7 @@ CREATE TABLE user_stats (
exptswapout_last datetime default NULL,
exptswapmod_count int(11) unsigned default '0',
exptswapmod_last datetime default NULL,
last_activity datetime default NULL,
allexpt_duration int(11) unsigned default '0',
allexpt_vnodes int(11) unsigned default '0',
allexpt_vnode_duration int(11) unsigned default '0',
......
......@@ -2726,3 +2726,20 @@ last_net_act,last_cpu_act,last_ext_act);
created datetime default NULL,
PRIMARY KEY (listname)
) TYPE=MyISAM;
4.3: Add a last_activity field to user_stats to make it easier to
determine recent users (in genelists).
alter table user_stats add last_activity datetime \
default NULL after exptswapmod_last;
To seed this table:
update user_stats set last_activity =
FROM_UNIXTIME(GREATEST(UNIX_TIMESTAMP(exptstart_last),
UNIX_TIMESTAMP(exptpreload_last),
UNIX_TIMESTAMP(exptswapin_last),
UNIX_TIMESTAMP(exptswapout_last),
UNIX_TIMESTAMP(exptswapmod_last)));
4.4:
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