Commit 0610d389 authored by Mac Newbold's avatar Mac Newbold
Browse files

Fix a slight race condition that has already bitten us several times in

real life.

There's a small window in time (typically a few seconds, but maybe 10's of
seconds on occasion) between the time nodes get nalloc'd and the time they
get rebooted during a swapin. If idlemail runs (or someone views a web
page) during this time, the expt can appear idle because the nodes haven't
had any activity. It can cause an incorrect email or a false positive on
the web page.

The fix is to have nalloc register some external node activity, like
node_reboot does, when it allocates a node.
parent 85c64a0c
......@@ -69,7 +69,7 @@ if ($UID) {
# do expansion of shark shelves
######################################################################
DBQueryFatal("lock tables nodes read, reserved write");
DBQueryFatal("lock tables nodes read, reserved write, node_activity write");
foreach my $n (@node_names) {
# Shark hack
......@@ -125,10 +125,18 @@ if ($debug) { print "List Ready: @vals\nError=$error\n"; }
######################################################################
if (!$error && @vals) {
if ($debug) {
print "Resetting node activity...\n";
}
my $cmd = "update node_activity set last_ext_act = now() where ".
join(" or ",map("node_id='$_'",@nodes));
DBQueryWarn($cmd);
# It isn't an error if this fails...
if ($debug) {
print "Reserving nodes...\n";
}
my $cmd = "insert into reserved (node_id,pid,eid,vname) values ".
$cmd = "insert into reserved (node_id,pid,eid,vname) values ".
join(",",@vals);
if (!DBQueryWarn($cmd)) {
$error++;
......
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