All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 4e63368f authored by Leigh B. Stoller's avatar Leigh B. Stoller

Fix some stats bugs that I uncovered while writing a stats checker/repairer

script.
parent 1d57505c
...@@ -1879,9 +1879,9 @@ sub PreSwap($$$$) ...@@ -1879,9 +1879,9 @@ sub PreSwap($$$$)
# #
# Rollback after a failed swap operation; cleans up the stats and resources. # Rollback after a failed swap operation; cleans up the stats and resources.
# #
sub SwapFail($$$$) sub SwapFail($$$$;$)
{ {
my ($self, $swapper, $which, $ecode) = @_; my ($self, $swapper, $which, $ecode, $flags) = @_;
# Must be a real reference. # Must be a real reference.
return -1 return -1
...@@ -1891,6 +1891,9 @@ sub SwapFail($$$$) ...@@ -1891,6 +1891,9 @@ sub SwapFail($$$$)
return 0 return 0
if ($EXPT_RESOURCESHOSED); if ($EXPT_RESOURCESHOSED);
$flags = 0
if (!defined($flags));
# Old swap gathering stuff. # Old swap gathering stuff.
$self->GatherSwapStats($swapper, $which, $ecode); $self->GatherSwapStats($swapper, $which, $ecode);
...@@ -1926,7 +1929,8 @@ sub SwapFail($$$$) ...@@ -1926,7 +1929,8 @@ sub SwapFail($$$$)
# experiment, but do not want to tackle that at this time # experiment, but do not want to tackle that at this time
# #
if (! $lastrsrc && ($which eq $EXPT_START || $which eq $EXPT_SWAPIN)) { if (! $lastrsrc && ($which eq $EXPT_START || $which eq $EXPT_SWAPIN)) {
DBQueryWarn("update experiment_resources set swapin_time=0 ". DBQueryWarn("update experiment_resources set swapin_time=0, ".
" vnodes=0,jailnodes=0,plabnodes=0,delaynodes=0 ".
"where idx='$rsrcidx'") "where idx='$rsrcidx'")
or return -1; or return -1;
} }
...@@ -1948,7 +1952,10 @@ sub SwapFail($$$$) ...@@ -1948,7 +1952,10 @@ sub SwapFail($$$$)
if ($which eq $EXPT_SWAPMOD && if ($which eq $EXPT_SWAPMOD &&
$self->state() eq libdb::EXPTSTATE_ACTIVE()) { $self->state() eq libdb::EXPTSTATE_ACTIVE()) {
DBQueryWarn("update experiment_resources set swapmod_time=0 ". DBQueryWarn("update experiment_resources set ".
($flags & libdb::TBDB_STATS_FLAGS_MODHOSED() ?
"swapout_time=swapmod_time, " : " ") .
"swapmod_time=0 ".
"where idx='$lastrsrc'") "where idx='$lastrsrc'")
or return -1; or return -1;
} }
......
...@@ -132,6 +132,7 @@ use vars qw(@ISA @EXPORT); ...@@ -132,6 +132,7 @@ use vars qw(@ISA @EXPORT);
TBDB_STATS_SWAPIN TBDB_STATS_SWAPOUT TBDB_STATS_SWAPMODIFY TBDB_STATS_SWAPIN TBDB_STATS_SWAPOUT TBDB_STATS_SWAPMODIFY
TBDB_STATS_FLAGS_IDLESWAP TBDB_STATS_FLAGS_PREMODIFY TBDB_STATS_FLAGS_IDLESWAP TBDB_STATS_FLAGS_PREMODIFY
TBDB_STATS_FLAGS_START TBDB_STATS_FLAGS_PRESWAPIN TBDB_STATS_FLAGS_START TBDB_STATS_FLAGS_PRESWAPIN
TBDB_STATS_FLAGS_MODHOSED
TBDB_JAILIPBASE TBDB_JAILIPMASK TBDB_JAILIPBASE TBDB_JAILIPMASK
...@@ -737,6 +738,7 @@ sub TBDB_STATS_FLAGS_PREMODIFY(){ 0x02; } ...@@ -737,6 +738,7 @@ sub TBDB_STATS_FLAGS_PREMODIFY(){ 0x02; }
sub TBDB_STATS_FLAGS_START() { 0x04; } sub TBDB_STATS_FLAGS_START() { 0x04; }
sub TBDB_STATS_FLAGS_PRESWAPIN(){ 0x08; } sub TBDB_STATS_FLAGS_PRESWAPIN(){ 0x08; }
sub TBDB_STATS_FLAGS_BATCHCTRL(){ 0x10; } sub TBDB_STATS_FLAGS_BATCHCTRL(){ 0x10; }
sub TBDB_STATS_FLAGS_MODHOSED() { 0x20; }
# Do not export these variables! # Do not export these variables!
my $TBDB_STATS_STARTCLOCK; my $TBDB_STATS_STARTCLOCK;
my $TBDB_STATS_SAVEDSWAPUID; my $TBDB_STATS_SAVEDSWAPUID;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group. # Copyright (c) 2000-2008 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
...@@ -1322,7 +1322,8 @@ sub cleanup() ...@@ -1322,7 +1322,8 @@ sub cleanup()
# that fails, but results in the experiment being restored the # that fails, but results in the experiment being restored the
# way it was. # way it was.
# #
$experiment->SwapFail($this_user, TBDB_STATS_SWAPMODIFY, $errorstat); $experiment->SwapFail($this_user, TBDB_STATS_SWAPMODIFY, $errorstat,
($modifyHosed ? TBDB_STATS_FLAGS_MODHOSED() :0));
if ($modifySwapped) { if ($modifySwapped) {
$experiment->PostSwap($this_user, TBDB_STATS_SWAPOUT); $experiment->PostSwap($this_user, TBDB_STATS_SWAPOUT);
} }
......
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