aboutsummaryrefslogtreecommitdiffstats
path: root/vespaclient
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@yahoo-inc.com>2017-09-12 16:01:49 +0200
committerTor Brede Vekterli <vekterli@yahoo-inc.com>2017-09-12 16:01:49 +0200
commitba4d752e36eb40a82b8ac685404a4ce1de29d248 (patch)
treecf9a0d93743b859101e1de485cc7a65355060057 /vespaclient
parent664dc8e147928cd05a16954cbfdd6efb34dd144a (diff)
Add --no-wait option to vespa-set-node-state
If option is set, will add a response-wait: no-wait field to request JSON. If not set, controller default is used.
Diffstat (limited to 'vespaclient')
-rw-r--r--vespaclient/src/perl/lib/Yahoo/Vespa/Bin/SetNodeState.pm9
-rw-r--r--vespaclient/src/perl/lib/Yahoo/Vespa/ClusterController.pm7
-rw-r--r--vespaclient/src/perl/test/Yahoo/Vespa/Bin/SetNodeStateTest.pl4
3 files changed, 16 insertions, 4 deletions
diff --git a/vespaclient/src/perl/lib/Yahoo/Vespa/Bin/SetNodeState.pm b/vespaclient/src/perl/lib/Yahoo/Vespa/Bin/SetNodeState.pm
index e49d00491bc..894ab7feca4 100644
--- a/vespaclient/src/perl/lib/Yahoo/Vespa/Bin/SetNodeState.pm
+++ b/vespaclient/src/perl/lib/Yahoo/Vespa/Bin/SetNodeState.pm
@@ -21,6 +21,7 @@ our $wanted_state;
our $wanted_state_description;
our $nodes_attempted_set;
our $success;
+our $no_wait;
return 1;
@@ -58,6 +59,10 @@ EOS
. "will show up in various admin tools. (Use double quotes to "
. "give a reason with whitespace in it)");
+ setOptionHeader("Options related to operation visibility:");
+ setFlagOption(['n', 'no-wait'], \$no_wait, "Do not wait for node state "
+ . "changes to be visible in the cluster before returning.");
+
Yahoo::Vespa::ContentNodeSelection::registerCommandLineArguments();
Yahoo::Vespa::VespaModel::registerCommandLineArguments();
handleCommandLineArguments($args);
@@ -83,7 +88,7 @@ sub execute { # ()
exitApplication(1);
}
if (!$success) {
- exitApplication(1);
+ exitApplication(1);
}
}
@@ -92,6 +97,6 @@ sub setNodeStateForNode {
my ($cluster, $type, $index) = (
$$info{'cluster'}, $$info{'type'}, $$info{'index'});
$success &&= setNodeUserState($cluster, $type, $index, $wanted_state,
- $wanted_state_description);
+ $wanted_state_description, $no_wait);
++$nodes_attempted_set;
}
diff --git a/vespaclient/src/perl/lib/Yahoo/Vespa/ClusterController.pm b/vespaclient/src/perl/lib/Yahoo/Vespa/ClusterController.pm
index 229253b659e..cac91885fb9 100644
--- a/vespaclient/src/perl/lib/Yahoo/Vespa/ClusterController.pm
+++ b/vespaclient/src/perl/lib/Yahoo/Vespa/ClusterController.pm
@@ -80,8 +80,8 @@ sub detectClusterController { # ()
enableAutomaticLineBreaks($oldVal);
}
}
-sub setNodeUserState { # (ClusterName, NodeType, Index, State, Reason)
- my ($cluster, $service, $index, $state, $reason) = @_;
+sub setNodeUserState { # (ClusterName, NodeType, Index, State, Reason, NoWait)
+ my ($cluster, $service, $index, $state, $reason, $no_wait) = @_;
my @params = ();
my @headers = (
'Content-Type' => 'application/json'
@@ -100,6 +100,9 @@ sub setNodeUserState { # (ClusterName, NodeType, Index, State, Reason)
}
}
};
+ if ($no_wait) {
+ $request->{'response-wait'} = 'no-wait';
+ }
my $content = Json::encode($request);
my $path = &getPathToNode($cluster, $service, $index);
diff --git a/vespaclient/src/perl/test/Yahoo/Vespa/Bin/SetNodeStateTest.pl b/vespaclient/src/perl/test/Yahoo/Vespa/Bin/SetNodeStateTest.pl
index adb8024e19b..b78dc66a311 100644
--- a/vespaclient/src/perl/test/Yahoo/Vespa/Bin/SetNodeStateTest.pl
+++ b/vespaclient/src/perl/test/Yahoo/Vespa/Bin/SetNodeStateTest.pl
@@ -65,6 +65,10 @@ Options:
-s : Create less verbose output.
--show-hidden : Also show hidden undocumented debug options.
+Options related to operation visibility:
+ -n --no-wait : Do not wait for node state changes to be visible in
+ the cluster before returning.
+
Node selection options. By default, nodes running locally will be selected:
-c --cluster : Cluster name of cluster to query. If unspecified,
and vespa is installed on current node, information