This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new 5a7dfbc [tools] mention whitespace as a separator for variadic args
5a7dfbc is described below
commit 5a7dfbcdd0d7728c6a7acfaf822f4059261aa8be
Author: Alexey Serbin <[email protected]>
AuthorDate: Fri Oct 23 12:52:22 2020 -0700
[tools] mention whitespace as a separator for variadic args
I witnessed a case when people try to use a comma as separators for
a variadic argument in a kudu CLI command. As it turned out, the
help/usage message doesn't state clearly that multiple items in a
variadic argument should be separated by a whitespace. This changelist
updates the description of existing variadic arguments to explicitly
mention that the whitespace is the expected separator there.
This patch does not contain any functional changes.
Change-Id: I3ef979bd17655b5d46e1adb2a2f22923353ac435
Reviewed-on: http://gerrit.cloudera.org:8080/16642
Reviewed-by: Andrew Wong <[email protected]>
Tested-by: Kudu Jenkins
---
src/kudu/tools/tool_action_diagnose.cc | 12 +++--
src/kudu/tools/tool_action_local_replica.cc | 17 ++++---
src/kudu/tools/tool_action_remote_replica.cc | 69 ++++++++++++++--------------
3 files changed, 52 insertions(+), 46 deletions(-)
diff --git a/src/kudu/tools/tool_action_diagnose.cc
b/src/kudu/tools/tool_action_diagnose.cc
index d6abb9c..ccbdf84 100644
--- a/src/kudu/tools/tool_action_diagnose.cc
+++ b/src/kudu/tools/tool_action_diagnose.cc
@@ -36,9 +36,6 @@
DECLARE_int64(timeout_ms);
DECLARE_string(format);
-namespace kudu {
-namespace tools {
-
using std::ifstream;
using std::string;
using std::unique_ptr;
@@ -46,10 +43,15 @@ using std::unordered_map;
using std::vector;
using strings::Substitute;
-const char* kLogPathArg = "path";
+namespace kudu {
+namespace tools {
namespace {
+constexpr const char* const kLogPathArg = "path";
+constexpr const char* const kLogPathArgDesc =
+ "Path(s) to log file(s) to parse, separated by a whitespace, if many";
+
Status ParseStacksFromPath(const string& path) {
errno = 0;
ifstream in(path);
@@ -87,7 +89,7 @@ unique_ptr<Mode> BuildDiagnoseMode() {
unique_ptr<Action> parse_stacks =
ActionBuilder("parse_stacks", &ParseStacks)
.Description("Parse sampled stack traces out of a diagnostics log")
- .AddRequiredVariadicParameter({ kLogPathArg, "path to log file(s) to
parse" })
+ .AddRequiredVariadicParameter({ kLogPathArg, kLogPathArgDesc })
.Build();
return ModeBuilder("diagnose")
diff --git a/src/kudu/tools/tool_action_local_replica.cc
b/src/kudu/tools/tool_action_local_replica.cc
index 70282e3..ae7f2de 100644
--- a/src/kudu/tools/tool_action_local_replica.cc
+++ b/src/kudu/tools/tool_action_local_replica.cc
@@ -146,16 +146,21 @@ using tserver::TSTabletManager;
namespace {
-const char* const kSeparatorLine =
+constexpr const char* const kSeparatorLine =
"----------------------------------------------------------------------\n";
-const char* const kTermArg = "term";
+constexpr const char* const kTermArg = "term";
-const char* const kTabletIdGlobArg = "tablet_id_pattern";
-const char* const kTabletIdGlobArgDesc = "Tablet identifier pattern. "
+constexpr const char* const kTabletIdGlobArg = "tablet_id_pattern";
+constexpr const char* const kTabletIdGlobArgDesc = "Tablet identifier pattern.
"
"This argument supports basic glob syntax: '*' matches 0 or more wildcard "
"characters.";
+constexpr const char* const kRaftPeersArg = "peers";
+constexpr const char* const kRaftPeersArgDesc =
+ "List of peers where each element is of form 'uuid:hostname:port', "
+ "with elements of the list separated by a whitespace";
+
string Indent(int indent) {
return string(indent, ' ');
}
@@ -885,9 +890,7 @@ unique_ptr<Mode> BuildLocalReplicaMode() {
ActionBuilder("rewrite_raft_config", &RewriteRaftConfig)
.Description("Rewrite a tablet replica's Raft configuration")
.AddRequiredParameter({ kTabletIdArg, kTabletIdArgDesc })
- .AddRequiredVariadicParameter({
- "peers", "List of peers where each peer is of "
- "form 'uuid:hostname:port'" })
+ .AddRequiredVariadicParameter({ kRaftPeersArg, kRaftPeersArgDesc })
.AddOptionalParameter("fs_data_dirs")
.AddOptionalParameter("fs_metadata_dir")
.AddOptionalParameter("fs_wal_dir")
diff --git a/src/kudu/tools/tool_action_remote_replica.cc
b/src/kudu/tools/tool_action_remote_replica.cc
index 44c2de6..89a31b3 100644
--- a/src/kudu/tools/tool_action_remote_replica.cc
+++ b/src/kudu/tools/tool_action_remote_replica.cc
@@ -70,19 +70,28 @@ DECLARE_string(table_name);
DECLARE_string(tablets);
DECLARE_int64(timeout_ms); // defined in ksck
-namespace kudu {
-namespace tools {
-
-using client::KuduRowResult;
-using client::KuduScanBatch;
-using client::KuduSchema;
-using consensus::ConsensusServiceProxy;
-using consensus::RaftConfigPB;
-using consensus::RaftPeerPB;
-using consensus::StartTabletCopyRequestPB;
-using consensus::StartTabletCopyResponsePB;
-using rpc::RpcController;
-using server::ServerStatusPB;
+using kudu::client::KuduRowResult;
+using kudu::client::KuduScanBatch;
+using kudu::client::KuduSchema;
+using kudu::consensus::ConsensusServiceProxy;
+using kudu::consensus::RaftConfigPB;
+using kudu::consensus::RaftPeerPB;
+using kudu::consensus::StartTabletCopyRequestPB;
+using kudu::consensus::StartTabletCopyResponsePB;
+using kudu::rpc::RpcController;
+using kudu::server::ServerStatusPB;
+using kudu::tablet::TabletStatusPB;
+using kudu::tserver::DeleteTabletRequestPB;
+using kudu::tserver::DeleteTabletResponsePB;
+using kudu::tserver::ListTabletsRequestPB;
+using kudu::tserver::ListTabletsResponsePB;
+using kudu::tserver::NewScanRequestPB;
+using kudu::tserver::ScanRequestPB;
+using kudu::tserver::ScanResponsePB;
+using kudu::tserver::TabletServer;
+using kudu::tserver::TabletServerAdminServiceProxy;
+using kudu::tserver::TabletServerErrorPB;
+using kudu::tserver::TabletServerServiceProxy;
using std::cerr;
using std::cout;
using std::endl;
@@ -90,18 +99,9 @@ using std::string;
using std::unique_ptr;
using std::unordered_set;
using std::vector;
-using tablet::TabletStatusPB;
-using tserver::DeleteTabletRequestPB;
-using tserver::DeleteTabletResponsePB;
-using tserver::ListTabletsRequestPB;
-using tserver::ListTabletsResponsePB;
-using tserver::NewScanRequestPB;
-using tserver::ScanRequestPB;
-using tserver::ScanResponsePB;
-using tserver::TabletServer;
-using tserver::TabletServerErrorPB;
-using tserver::TabletServerAdminServiceProxy;
-using tserver::TabletServerServiceProxy;
+
+namespace kudu {
+namespace tools {
// This class only exists so that Dump() can easily be friended with
// KuduSchema and KuduScanBatch.
@@ -168,15 +168,16 @@ class ReplicaDumper {
namespace {
-const char* const kReasonArg = "reason";
-const char* const kTServerAddressArg = "tserver_address";
-const char* const kTServerAddressDesc = "Address of a Kudu Tablet Server of "
- "form 'hostname:port'. Port may be omitted if the Tablet Server is bound "
- "to the default port.";
-const char* const kSrcAddressArg = "src_address";
-const char* const kDstAddressArg = "dst_address";
-const char* const kPeerUUIDsArg = "peer uuids";
-const char* const kPeerUUIDsArgDesc = "List of peer uuids to be part of new
config";
+constexpr const char* const kReasonArg = "reason";
+constexpr const char* const kTServerAddressArg = "tserver_address";
+constexpr const char* const kTServerAddressDesc =
+ "Address of a Kudu Tablet Server of form 'hostname:port'. Port may be "
+ "omitted if the Tablet Server is bound to the default port.";
+constexpr const char* const kSrcAddressArg = "src_address";
+constexpr const char* const kDstAddressArg = "dst_address";
+constexpr const char* const kPeerUUIDsArg = "peer uuids";
+constexpr const char* const kPeerUUIDsArgDesc =
+ "List of peer uuids to be part of new config, separated by whitespace";
Status GetReplicas(TabletServerServiceProxy* proxy,
vector<ListTabletsResponsePB::StatusAndSchemaPB>* replicas)
{