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 7f6d819 [tool] KUDU-3343 Display the "Data state" and "Last status"
in remote_replica list command.
7f6d819 is described below
commit 7f6d81925fb9062df5d6c4b7b5ba5807419d7b05
Author: yejiabao <[email protected]>
AuthorDate: Sun Dec 12 21:12:54 2021 +0800
[tool] KUDU-3343 Display the "Data state" and "Last status" in
remote_replica list command.
It's will make simple and more detail to judge tablet state by
"Data state" and "Last status" in remote_replica list
Change-Id: I9c6b28a7a6d69f04872b28e5b57c0fcfea915777
Reviewed-on: http://gerrit.cloudera.org:8080/18092
Tested-by: Kudu Jenkins
Reviewed-by: Bankim Bhavsar <[email protected]>
Reviewed-by: Alexey Serbin <[email protected]>
---
src/kudu/tools/kudu-tool-test.cc | 6 ++++++
src/kudu/tools/tool_action_remote_replica.cc | 3 +++
2 files changed, 9 insertions(+)
diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc
index 0c60b9f..df435a6 100644
--- a/src/kudu/tools/kudu-tool-test.cc
+++ b/src/kudu/tools/kudu-tool-test.cc
@@ -3401,6 +3401,8 @@ TEST_F(ToolTest, TestRemoteReplicaList) {
ASSERT_STR_CONTAINS(stdout,
Substitute("Table name: $0", workload.table_name()));
ASSERT_STR_CONTAINS(stdout, "key INT32 NOT NULL");
+ ASSERT_STR_CONTAINS(stdout, "Last status: No bootstrap required, opened a
new log");
+ ASSERT_STR_CONTAINS(stdout, "Data state: TABLET_DATA_READY");
ASSERT_STR_CONTAINS(stdout,
Substitute("Data dirs: $0", JoinStrings(tablet_status.data_dirs(), ",
")));
}
@@ -3412,6 +3414,8 @@ TEST_F(ToolTest, TestRemoteReplicaList) {
Substitute("remote_replica list $0 --include_schema=false", ts_addr),
&stdout));
ASSERT_STR_NOT_CONTAINS(stdout, "key INT32 NOT NULL");
+ ASSERT_STR_CONTAINS(stdout, "Last status: No bootstrap required, opened a
new log");
+ ASSERT_STR_CONTAINS(stdout, "Data state: TABLET_DATA_READY");
}
{
@@ -3465,6 +3469,8 @@ TEST_F(ToolTest, TestRemoteReplicaList) {
Substitute("Tablet id: $0",
tablet_status.tablet_id()));
ASSERT_STR_CONTAINS(stdout,
Substitute("Table name: $0", workload.table_name()));
+ ASSERT_STR_CONTAINS(stdout, "Last status: Deleted tablet blocks from
disk");
+ ASSERT_STR_CONTAINS(stdout, "Data state: TABLET_DATA_TOMBSTONED");
ASSERT_STR_CONTAINS(stdout, "Data dirs: <not available>");
}
}
diff --git a/src/kudu/tools/tool_action_remote_replica.cc
b/src/kudu/tools/tool_action_remote_replica.cc
index 9aff3ee..7e7ba43 100644
--- a/src/kudu/tools/tool_action_remote_replica.cc
+++ b/src/kudu/tools/tool_action_remote_replica.cc
@@ -317,6 +317,7 @@ Status ListReplicas(const RunnerContext& context) {
const string& state = tablet::TabletStatePB_Name(rs.state());
cout << "Tablet id: " << rs.tablet_id() << endl;
cout << "State: " << state << endl;
+ cout << "Last status: " << rs.last_status() << endl;
cout << "Table name: " << rs.table_name() << endl;
cout << "Partition: "
<< partition_schema.PartitionDebugString(partition, schema) << endl;
@@ -324,6 +325,8 @@ Status ListReplicas(const RunnerContext& context) {
cout << "Estimated on disk size: "
<< HumanReadableNumBytes::ToString(rs.estimated_on_disk_size()) <<
endl;
}
+ const string& data_state =
tablet::TabletDataState_Name(rs.tablet_data_state());
+ cout << "Data state: " << data_state << endl;
if (rs.data_dirs_size() != 0) {
cout << "Data dirs: " << JoinStrings(rs.data_dirs(), ", ") << endl;
} else {