This is an automated email from the ASF dual-hosted git repository. laiyingchun pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
commit f88c33ccab88f2e6f9bf8c2155f7115e79645882 Author: xinghuayu007 <[email protected]> AuthorDate: Sat Nov 5 22:50:19 2022 +0800 [KUDU-3420] Fixbug of list local replica Execute command: kudu local_replica list -fs_data_dirs=.... -fs_wal_dir=... --list_detail=true will core. Because this command inits fs manager without opening block manager, but it still uses fs mananger to get data dir group PB. The core stack: @ 0x14ee526 (unknown) @ 0x7f677076f630 (unknown) @ 0x13ba311 kudu::tablet::TabletMetadata::LoadFromSuperBlock() @ 0x13bafa0 kudu::tablet::TabletMetadata::LoadFromDisk() @ 0x13bb2a5 kudu::tablet::TabletMetadata::Load() @ 0xe00d88 kudu::tools::DumpTabletMeta() @ 0xe01417 kudu::tools::ListLocalReplicas() @ 0xdc2824 std::_Function_handler<>::_M_invoke() @ 0x1542350 kudu::tools::Action::Run() @ 0xe774e5 kudu::tools::DispatchCommand() @ 0xe77fb7 kudu::tools::RunTool() @ 0xd2ca13 main @ 0x7f676e960555 __libc_start_main @ 0xdad58 See the detail #KUDU-3420 Change-Id: I7d8551280ad8edd416a0dd1b9611185cabe1a5bc Reviewed-on: http://gerrit.cloudera.org:8080/19209 Reviewed-by: Yingchun Lai <[email protected]> Tested-by: Yingchun Lai <[email protected]> --- src/kudu/tools/kudu-tool-test.cc | 10 ++++++++++ src/kudu/tools/tool_action_local_replica.cc | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/kudu/tools/kudu-tool-test.cc b/src/kudu/tools/kudu-tool-test.cc index d08859397..2f24822fb 100644 --- a/src/kudu/tools/kudu-tool-test.cc +++ b/src/kudu/tools/kudu-tool-test.cc @@ -2957,6 +2957,16 @@ TEST_F(ToolTest, TestLocalReplicaOps) { ASSERT_STR_MATCHES(stdout, kTestTablet); } + { + string stdout; + NO_FATALS(RunActionStdoutString( + Substitute("local_replica list $0 $1 --list_detail=true", + fs_paths, encryption_args), &stdout)); + + SCOPED_TRACE(stdout); + ASSERT_STR_MATCHES(stdout, kTestTablet); + } + // Test 'kudu fs list' tablet group. { string stdout; diff --git a/src/kudu/tools/tool_action_local_replica.cc b/src/kudu/tools/tool_action_local_replica.cc index 8d807261a..1f730b314 100644 --- a/src/kudu/tools/tool_action_local_replica.cc +++ b/src/kudu/tools/tool_action_local_replica.cc @@ -930,7 +930,8 @@ Status DumpTabletMeta(FsManager* fs_manager, Status ListLocalReplicas(const RunnerContext& context) { unique_ptr<FsManager> fs_manager; - RETURN_NOT_OK(FsInit(/*skip_block_manager*/true, &fs_manager)); + bool skip_block_manager = !FLAGS_list_detail; + RETURN_NOT_OK(FsInit(skip_block_manager, &fs_manager)); vector<string> tablets; RETURN_NOT_OK(fs_manager->ListTabletIds(&tablets));
