Commit 9b361140 authored by Dan Gebhardt's avatar Dan Gebhardt

Periodic checkin. Some bug fixes, feature additions, etc.. things seem to

be working well right now.
parent 66788d1b
......@@ -141,7 +141,7 @@ while(1)
outputErrors();
sleep( 60 );
sleep( 60*5 );
$f_firsttime = 0;
}
......@@ -195,7 +195,7 @@ sub choosenodes
if( $bestnode ne "NONE" &&
!defined $intersitenodes{$site} )
{
print "SECTION 1: adding $bestnode at $site\n";
print time()." SECTION 1: adding $bestnode at $site\n";
# ** This section handles when a site is seen for the 1st time
#set new node to represent this site
......@@ -205,7 +205,7 @@ sub choosenodes
}
elsif( ("NONE" eq $bestnode) && defined $intersitenodes{$site} )
{
print "SECTION 2: removing tests to $site / ".
print time()." SECTION 2: removing tests to $site / ".
"$intersitenodes{$site} \n";
# ** This section handles when a site has no nodes available
......@@ -221,7 +221,7 @@ sub choosenodes
#&& isnodeinconstrset($bestnode)
)
{
print "SECTION 3: node change at $site from ".
print time()." SECTION 3: node change at $site from ".
"$intersitenodes{$site} to $bestnode\n";
# ** This section handles when a "bestnode" at a site changes
......@@ -341,18 +341,9 @@ sub choosebestnode($)
$flag_siteIncluded = 1;
# print "SETTING SITEINCLUDED=1 for $node at $site\n";
}
#this command acts like a bgmon "ping" - used to
#determine if bgmon running correctly
=pod
my %cmd = ( expid => $expid,
cmdtype => "EDIT",
dstnode => "NOADDR",
testtype => "bw",
testper => 0,
limitTime=> 0 );
=cut
if( $allnodes{$node}{free} == 1 && isnodeinconstrset($node) ){
print "choosebestnode: considering $node\n";
# print "choosebestnode: considering $node\n";
# print "choosing best node for site $site\n";
#first time thru loop...
if( $bestnode eq "NONE" ){
......@@ -492,7 +483,7 @@ sub stoppairtest($$)
foreach my $testtype (@testtypes){
edittest($srcnode, $destnode, 0, $testtype);
}
print "stopping pair tests from $srcnode to $destnode\n";
# print "stopping pair tests from $srcnode to $destnode\n";
}
#
......
This diff is collapsed.
......@@ -10,7 +10,6 @@ use IO::Select;
require Exporter;
@ISA = "Exporter";
@EXPORT = qw (
%deadnodes
%ERRID
......@@ -26,16 +25,24 @@ require Exporter;
);
# These errors define specifics of when a measurement value cannot be
# reported due to some error in the network or at the remote end.
our %ERRID;
$ERRID{timeout} = -1;
$ERRID{ttlexceed} = -2; # was an error for "ping", but is not seen in fping.
$ERRID{unknown} = -3; # general error, which cannot be classified into others
$ERRID{unknownhost} = -4;
$ERRID{ICMPunreachable} = -5; #used for all ICMP errors (see fping.c for strs)
$ERRID{iperfHostUnreachable} = -6; #for iperf: error flagged by: write1 failed: Broken pipe
our %deadnodes;
my $socket;
my $sel = IO::Select->new();
my $port;
my $expid;
my %deadnodes;
my %ERRID;
$ERRID{timeout} = -1;
$ERRID{ttlexceed} = -2;
$ERRID{unknown} = -3;
sub setcmdport($)
......@@ -114,12 +121,10 @@ sub sendcmd($$)
PeerAddr => $node,
Timeout => 1 );
if( defined $socket ){
$sel->add($socket);
# $sel->add($socket);
print $socket "$sercmd\n";
#todo: wait for ack;
# timeout period?
$sel->add($socket);
my ($ready) = $sel->can_read(1);
my ($ready) = $sel->can_read(2); #timeout (seconds) (?)
if( defined($ready) && $ready eq $socket ){
my $ack = <$ready>;
# chomp $ack;
......
......@@ -43,22 +43,24 @@ my $duplicateKillThresh = 5; #kill node if this many duplicates occur per index
$| = 1;
sub usage {
print "Usage: $0 [-p receiveport] [-a sendport] [-e pid/eid] [-d] [-i]\n";
print "Usage: $0 [-p receiveport] [-a sendport] [-e pid/eid]".
" [-d debuglevel] [-i]\n";
return 1;
}
my $debug = 0;
my $impotent = 0;
my $debug = 0;
my ($port, $sendport, $expid);
my %opt = ();
if (!getopts("p:a:e:dih", \%opt)) {
if (!getopts("p:a:e:d:ih", \%opt)) {
exit &usage;
}
if ($opt{p}) { $port = $opt{p}; } else { $port = 5051; }
if ($opt{a}) { $sendport = $opt{a}; } else { $sendport = 5050; }
if ($opt{h}) { exit &usage; }
if ($opt{e}) { $expid = $opt{e}; } else { $expid = "none"; }
if ($opt{d}) { $debug = 1; }
if ($opt{d}) { $debug = $opt{d}; } else { $debug = 0; }
if ($opt{i}) { $impotent = 1; }
if (@ARGV !=0) { exit &usage; }
......@@ -133,13 +135,13 @@ sub handleincomingmsgs()
return;
}
print "\n";
print "\n" if( $debug > 1 );
print("linksrc=$linksrc\n".
"linkdest=$linkdest\n".
"testtype =$testtype\n".
"result=$result\n".
"index=$index\n".
"tstamp=$tstamp\n");
"tstamp=$tstamp\n") if( $debug > 1 );
if( defined $linksrc ){
my $socket_snd =
......@@ -153,7 +155,7 @@ sub handleincomingmsgs()
if( defined %ack && defined $socket_snd ){
my $ack_serial = serialize_hash( \%ack );
$socket_snd->send($ack_serial);
print "**SENT ACK**\n";
print "**SENT ACK**\n" if( $debug > 1 );
if( !defined $lasttimestamp{$linksrc}{$index} ||
$tstamp ne $lasttimestamp{$linksrc}{$index} )
......@@ -163,16 +165,19 @@ sub handleincomingmsgs()
testtype => $testtype,
result => $result,
tstamp => $tstamp );
#decrement duplicatecnt for corresponding result index
#clear duplicatecnt for corresponding result index
if( defined($duplicatecnt{$linksrc}{$index}) ){
$duplicatecnt{$linksrc}{$index}--
if( $duplicatecnt{$linksrc}{$index} > 0 );
}else{
$duplicatecnt{$linksrc}{$index} = 0;
delete $duplicatecnt{$linksrc}{$index};
}
}else{
print "++++++duplicate data\n";
print("++++++duplicate data\n".
"linksrc=$linksrc\n".
"linkdest=$linkdest\n".
"testtype =$testtype\n".
"result=$result\n".
"index=$index\n".
"tstamp=$tstamp\n") if( $debug > 0);
#increment duplicatecnt for this src and index number
if( defined($duplicatecnt{$linksrc}{$index}) ){
$duplicatecnt{$linksrc}{$index}++;
......@@ -181,7 +186,8 @@ sub handleincomingmsgs()
> $duplicateKillThresh )
{
killnode($linksrc);
print "KILLING OFF BGMON at $linksrc\n";
print "KILLING OFF BGMON at $linksrc".
" for index $index\n" if( $debug > 0 );
delete $duplicatecnt{$linksrc};
}
}else{
......@@ -297,7 +303,7 @@ sub SendBatchedInserts()
DBQueryWarn($insertions)
if (!$impotent);
print "$insertions\n"
if ($debug);
if ($debug > 2);
$lastinsert = time();
}
$batchsize = 0;
......
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