From 2e30b2a8fca48d472143a9782b2f2449dcd6cfc2 Mon Sep 17 00:00:00 2001 From: Adar Dembo Date: Fri, 9 Sep 2016 13:48:13 -0700 Subject: [PATCH] tool: rename tablet mode to local_replica The tablet mode isn't actually going away, we're just going to use it for "remote operations that are scoped to an entire tablet". Change-Id: I2022a49817bfa48b74c734fd849d92d1f15a697f Reviewed-on: http://gerrit.cloudera.org:8080/4355 Reviewed-by: Todd Lipcon Tested-by: Kudu Jenkins --- docs/release_notes.adoc | 2 +- .../integration-tests/master_failover-itest.cc | 6 +++--- .../integration-tests/master_migration-itest.cc | 6 +++--- src/kudu/tools/CMakeLists.txt | 2 +- src/kudu/tools/kudu-tool-test.cc | 13 +++++++------ src/kudu/tools/tool_action.h | 2 +- ...tion_tablet.cc => tool_action_local_replica.cc} | 14 +++++++------- src/kudu/tools/tool_main.cc | 2 +- 8 files changed, 24 insertions(+), 23 deletions(-) rename src/kudu/tools/{tool_action_tablet.cc => tool_action_local_replica.cc} (96%) diff --git a/docs/release_notes.adoc b/docs/release_notes.adoc index 9a431fca83..2388bcea5c 100644 --- a/docs/release_notes.adoc +++ b/docs/release_notes.adoc @@ -59,7 +59,7 @@ Kudu 1.0.0 are not supported. implemented as `kudu fs cfile_dump`. - The `log-dump` tool has been removed. The same functionality is now - implemented as `kudu wal dump` and `kudu tablet dump_wals`. + implemented as `kudu wal dump` and `kudu local_replica dump_wals`. - KuduSession methods in the C++ library are no longer advertised as thread-safe to have one set of semantics for both C++ and Java Kudu client libraries. diff --git a/src/kudu/integration-tests/master_failover-itest.cc b/src/kudu/integration-tests/master_failover-itest.cc index a2205c64af..506335012c 100644 --- a/src/kudu/integration-tests/master_failover-itest.cc +++ b/src/kudu/integration-tests/master_failover-itest.cc @@ -379,7 +379,7 @@ TEST_F(MasterFailoverTest, TestMasterPermanentFailure) { { vector args = { kBinPath, - "tablet", + "local_replica", "cmeta", "print_replica_uuids", "--fs_wal_dir=" + other_master->data_dir(), @@ -419,8 +419,8 @@ TEST_F(MasterFailoverTest, TestMasterPermanentFailure) { { vector args = { kBinPath, - "tablet", - "copy", + "local_replica", + "copy_from_remote", "--fs_wal_dir=" + data_root, "--fs_data_dirs=" + data_root, master::SysCatalogTable::kSysCatalogTabletId, diff --git a/src/kudu/integration-tests/master_migration-itest.cc b/src/kudu/integration-tests/master_migration-itest.cc index ee9fb597e3..b01cda0390 100644 --- a/src/kudu/integration-tests/master_migration-itest.cc +++ b/src/kudu/integration-tests/master_migration-itest.cc @@ -140,7 +140,7 @@ TEST_F(MasterMigrationTest, TestEndToEndMigration) { string data_root = cluster_->GetDataPath("master-0"); vector args = { kBinPath, - "tablet", + "local_replica", "cmeta", "rewrite_raft_config", "--fs_wal_dir=" + data_root, @@ -168,8 +168,8 @@ TEST_F(MasterMigrationTest, TestEndToEndMigration) { string data_root = cluster_->GetDataPath(Substitute("master-$0", i)); vector args = { kBinPath, - "tablet", - "copy", + "local_replica", + "copy_from_remote", "--fs_wal_dir=" + data_root, "--fs_data_dirs=" + data_root, SysCatalogTable::kSysCatalogTabletId, diff --git a/src/kudu/tools/CMakeLists.txt b/src/kudu/tools/CMakeLists.txt index c7c5a5fdca..9a029fb021 100644 --- a/src/kudu/tools/CMakeLists.txt +++ b/src/kudu/tools/CMakeLists.txt @@ -89,8 +89,8 @@ add_executable(kudu tool_action_cluster.cc tool_action_common.cc tool_action_fs.cc + tool_action_local_replica.cc tool_action_pbc.cc - tool_action_tablet.cc tool_action_wal.cc tool_main.cc ) diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc index b018f3b80c..89a0725fae 100644 --- a/src/kudu/tools/kudu-tool-test.cc +++ b/src/kudu/tools/kudu-tool-test.cc @@ -167,8 +167,8 @@ TEST_F(ToolTest, TestTopLevelHelp) { const vector kTopLevelRegexes = { "cluster.*Kudu cluster", "fs.*Kudu filesystem", + "local_replica.*Kudu replicas", "pbc.*protobuf container", - "tablet.*Kudu replica", "wal.*write-ahead log" }; NO_FATALS(RunTestHelp("", kTopLevelRegexes)); @@ -188,19 +188,19 @@ TEST_F(ToolTest, TestModeHelp) { Status::InvalidArgument("unknown command 'not_a_mode'"))); } { - const vector kTabletModeRegexes = { + const vector kLocalReplicaModeRegexes = { "cmeta.*consensus metadata file", - "copy.*Copy a replica", + "copy_from_remote.*Copy a replica", "dump_wals.*Dump all WAL" }; - NO_FATALS(RunTestHelp("tablet", kTabletModeRegexes)); + NO_FATALS(RunTestHelp("local_replica", kLocalReplicaModeRegexes)); } { const vector kCmetaModeRegexes = { "print_replica_uuids.*Print all replica UUIDs", "rewrite_raft_config.*Rewrite a replica" }; - NO_FATALS(RunTestHelp("tablet cmeta", kCmetaModeRegexes)); + NO_FATALS(RunTestHelp("local_replica cmeta", kCmetaModeRegexes)); } { const vector kClusterModeRegexes = { @@ -404,7 +404,8 @@ TEST_F(ToolTest, TestWalDump) { string wal_path = fs.GetWalSegmentFileName(kTestTablet, 1); string stdout; for (const auto& args : { Substitute("wal dump $0", wal_path), - Substitute("tablet dump_wals --fs_wal_dir=$0 $1", kTestDir, kTestTablet) + Substitute("local_replica dump_wals --fs_wal_dir=$0 $1", + kTestDir, kTestTablet) }) { SCOPED_TRACE(args); for (const auto& print_entries : { "true", "1", "yes", "decoded" }) { diff --git a/src/kudu/tools/tool_action.h b/src/kudu/tools/tool_action.h index e8bdc90b63..1730a1d99c 100644 --- a/src/kudu/tools/tool_action.h +++ b/src/kudu/tools/tool_action.h @@ -274,8 +274,8 @@ class Action { // Returns new nodes for each major mode. std::unique_ptr BuildClusterMode(); std::unique_ptr BuildFsMode(); +std::unique_ptr BuildLocalReplicaMode(); std::unique_ptr BuildPbcMode(); -std::unique_ptr BuildTabletMode(); std::unique_ptr BuildWalMode(); } // namespace tools diff --git a/src/kudu/tools/tool_action_tablet.cc b/src/kudu/tools/tool_action_local_replica.cc similarity index 96% rename from src/kudu/tools/tool_action_tablet.cc rename to src/kudu/tools/tool_action_local_replica.cc index 736c2e501b..17aecaff43 100644 --- a/src/kudu/tools/tool_action_tablet.cc +++ b/src/kudu/tools/tool_action_local_replica.cc @@ -176,7 +176,7 @@ Status RewriteRaftConfig(const RunnerContext& context) { return cmeta->Flush(); } -Status Copy(const RunnerContext& context) { +Status CopyFromRemote(const RunnerContext& context) { // Parse the tablet ID and source arguments. string tablet_id = FindOrDie(context.required_args, "tablet_id"); string rpc_address = FindOrDie(context.required_args, "source"); @@ -223,7 +223,7 @@ Status DumpWals(const RunnerContext& context) { } // anonymous namespace -unique_ptr BuildTabletMode() { +unique_ptr BuildLocalReplicaMode() { unique_ptr print_replica_uuids = ActionBuilder("print_replica_uuids", &PrintReplicaUuids) .Description("Print all replica UUIDs found in a tablet's Raft configuration") @@ -249,8 +249,8 @@ unique_ptr BuildTabletMode() { .AddAction(std::move(rewrite_raft_config)) .Build(); - unique_ptr copy = - ActionBuilder("copy", &Copy) + unique_ptr copy_from_remote = + ActionBuilder("copy_from_remote", &CopyFromRemote) .Description("Copy a replica from a remote server") .AddRequiredParameter({ "tablet_id", "Tablet identifier" }) .AddRequiredParameter({ "source", "Source RPC address of form hostname:port" }) @@ -269,10 +269,10 @@ unique_ptr BuildTabletMode() { .AddOptionalParameter("truncate_data") .Build(); - return ModeBuilder("tablet") - .Description("Operate on a local Kudu replica") + return ModeBuilder("local_replica") + .Description("Operate on local Kudu replicas via the local filesystem") .AddMode(std::move(cmeta)) - .AddAction(std::move(copy)) + .AddAction(std::move(copy_from_remote)) .AddAction(std::move(dump_wals)) .Build(); } diff --git a/src/kudu/tools/tool_main.cc b/src/kudu/tools/tool_main.cc index f1fbe93556..c18065d773 100644 --- a/src/kudu/tools/tool_main.cc +++ b/src/kudu/tools/tool_main.cc @@ -113,8 +113,8 @@ int RunTool(int argc, char** argv, bool show_help) { .Description("doesn't matter") // root mode description isn't printed .AddMode(BuildClusterMode()) .AddMode(BuildFsMode()) + .AddMode(BuildLocalReplicaMode()) .AddMode(BuildPbcMode()) - .AddMode(BuildTabletMode()) .AddMode(BuildWalMode()) .Build();