Skip to content
Snippets Groups Projects
Commit 182e950b authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Hmm, forgot to commit the node_update changes that switch to a client

initiated model for updating remote nodes.
parent 192298fe
No related branches found
No related tags found
No related merge requests found
...@@ -88,6 +88,7 @@ my $logname; ...@@ -88,6 +88,7 @@ my $logname;
my %pids = (); my %pids = ();
my $failed = 0; my $failed = 0;
my $dbuid; my $dbuid;
my @remotenodes = ();
# #
# We don't want to run this script unless its the real version. # We don't want to run this script unless its the real version.
...@@ -195,6 +196,24 @@ if (! @nodes) { ...@@ -195,6 +196,24 @@ if (! @nodes) {
fatal("No Nodes in the experiment"); fatal("No Nodes in the experiment");
} }
#
# For widearea nodes, just update flag them in the DB. The nodes will
# notice this and suck the data over when they can.
#
foreach my $node ( @nodes ) {
if (TBIsNodeRemote($node) && !TBIsNodeVirtual($node)) {
print STDOUT "Marking widearea node $node for update.\n";
#
# No point in incrementing the flag past 2!
#
DBQueryFatal("update nodes set update_accounts=update_accounts+1 ".
"where node_id='$node' and update_accounts<2");
push(@remotenodes, $node);
}
}
# #
# We want some overlap, but not too much since we could burn up # We want some overlap, but not too much since we could burn up
# a lot processes on wedged nodes. Issue a small number in parallel, # a lot processes on wedged nodes. Issue a small number in parallel,
...@@ -203,6 +222,13 @@ if (! @nodes) { ...@@ -203,6 +222,13 @@ if (! @nodes) {
# #
my $maxpids = 0; my $maxpids = 0;
foreach my $node ( @nodes ) { foreach my $node ( @nodes ) {
#
# Remote nodes handled just above.
#
if (TBIsNodeRemote($node) || TBIsNodeVirtual($node)) {
next;
}
while ($maxpids >= $maxchildren) { while ($maxpids >= $maxchildren) {
my $thispid = waitpid(-1, 0); my $thispid = waitpid(-1, 0);
my $thisnode = $pids{$thispid}; my $thisnode = $pids{$thispid};
...@@ -212,7 +238,7 @@ foreach my $node ( @nodes ) { ...@@ -212,7 +238,7 @@ foreach my $node ( @nodes ) {
print STDERR "Update of node $thisnode failed!\n"; print STDERR "Update of node $thisnode failed!\n";
} }
else { else {
print STDOUT "$thisnode updated ...\n"; print STDOUT "$thisnode updated.\n";
} }
delete($pids{$thispid}); delete($pids{$thispid});
...@@ -236,7 +262,36 @@ foreach my $thispid ( keys(%pids) ) { ...@@ -236,7 +262,36 @@ foreach my $thispid ( keys(%pids) ) {
print STDERR "Update of node $node failed!\n"; print STDERR "Update of node $node failed!\n";
} }
else { else {
print STDOUT "$node updated ...\n"; print STDOUT "$node updated.\n";
}
}
#
# Wait a couple of minutes for remote nodes to do the update. We know
# this cause tmcd decrements the update_accounts flag whenever a node
# picks up new accounts.
#
if (@remotenodes) {
print STDOUT "Waiting a while for widearea nodes to update ...\n";
sleep(90);
my $foo = pop(@remotenodes);
my $str = "node_id='$foo' ";
foreach my $node ( @remotenodes ) {
$str .= "or node_id='$node' ";
}
my $query_result =
DBQueryFatal("select node_id,update_accounts from nodes ".
"where ($str)");
while (my ($node,$notdone) = $query_result->fetchrow_array) {
if ($notdone) {
$failed++;
print STDERR "Update of node $node has not completed!\n";
}
else {
print STDOUT "$node updated.\n";
}
} }
} }
...@@ -255,7 +310,7 @@ sub UpdateNode { ...@@ -255,7 +310,7 @@ sub UpdateNode {
my($node) = @_; my($node) = @_;
my($syspid, $mypid); my($syspid, $mypid);
print STDOUT "Updating $node ...\n"; print STDOUT "Updating $node.\n";
# #
# We need to know if its a remote or local node, so we know how # We need to know if its a remote or local node, so we know how
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment