Skip to content

Commit

Permalink
tool: rename tablet mode to local_replica
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Kudu Jenkins
  • Loading branch information
adembo committed Sep 10, 2016
1 parent b5fc3a6 commit 2e30b2a
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/release_notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/kudu/integration-tests/master_failover-itest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ TEST_F(MasterFailoverTest, TestMasterPermanentFailure) {
{
vector<string> args = {
kBinPath,
"tablet",
"local_replica",
"cmeta",
"print_replica_uuids",
"--fs_wal_dir=" + other_master->data_dir(),
Expand Down Expand Up @@ -419,8 +419,8 @@ TEST_F(MasterFailoverTest, TestMasterPermanentFailure) {
{
vector<string> args = {
kBinPath,
"tablet",
"copy",
"local_replica",
"copy_from_remote",
"--fs_wal_dir=" + data_root,
"--fs_data_dirs=" + data_root,
master::SysCatalogTable::kSysCatalogTabletId,
Expand Down
6 changes: 3 additions & 3 deletions src/kudu/integration-tests/master_migration-itest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ TEST_F(MasterMigrationTest, TestEndToEndMigration) {
string data_root = cluster_->GetDataPath("master-0");
vector<string> args = {
kBinPath,
"tablet",
"local_replica",
"cmeta",
"rewrite_raft_config",
"--fs_wal_dir=" + data_root,
Expand Down Expand Up @@ -168,8 +168,8 @@ TEST_F(MasterMigrationTest, TestEndToEndMigration) {
string data_root = cluster_->GetDataPath(Substitute("master-$0", i));
vector<string> args = {
kBinPath,
"tablet",
"copy",
"local_replica",
"copy_from_remote",
"--fs_wal_dir=" + data_root,
"--fs_data_dirs=" + data_root,
SysCatalogTable::kSysCatalogTabletId,
Expand Down
2 changes: 1 addition & 1 deletion src/kudu/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
13 changes: 7 additions & 6 deletions src/kudu/tools/kudu-tool-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ TEST_F(ToolTest, TestTopLevelHelp) {
const vector<string> 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));
Expand All @@ -188,19 +188,19 @@ TEST_F(ToolTest, TestModeHelp) {
Status::InvalidArgument("unknown command 'not_a_mode'")));
}
{
const vector<string> kTabletModeRegexes = {
const vector<string> 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<string> 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<string> kClusterModeRegexes = {
Expand Down Expand Up @@ -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" }) {
Expand Down
2 changes: 1 addition & 1 deletion src/kudu/tools/tool_action.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ class Action {
// Returns new nodes for each major mode.
std::unique_ptr<Mode> BuildClusterMode();
std::unique_ptr<Mode> BuildFsMode();
std::unique_ptr<Mode> BuildLocalReplicaMode();
std::unique_ptr<Mode> BuildPbcMode();
std::unique_ptr<Mode> BuildTabletMode();
std::unique_ptr<Mode> BuildWalMode();

} // namespace tools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -223,7 +223,7 @@ Status DumpWals(const RunnerContext& context) {

} // anonymous namespace

unique_ptr<Mode> BuildTabletMode() {
unique_ptr<Mode> BuildLocalReplicaMode() {
unique_ptr<Action> print_replica_uuids =
ActionBuilder("print_replica_uuids", &PrintReplicaUuids)
.Description("Print all replica UUIDs found in a tablet's Raft configuration")
Expand All @@ -249,8 +249,8 @@ unique_ptr<Mode> BuildTabletMode() {
.AddAction(std::move(rewrite_raft_config))
.Build();

unique_ptr<Action> copy =
ActionBuilder("copy", &Copy)
unique_ptr<Action> 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" })
Expand All @@ -269,10 +269,10 @@ unique_ptr<Mode> 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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/kudu/tools/tool_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 2e30b2a

Please sign in to comment.