Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/18834 )
Change subject: [tool] Add output format for 'table list' CLI tool. ...................................................................... Patch Set 7: (15 comments) http://gerrit.cloudera.org:8080/#/c/18834/10//COMMIT_MSG Commit Message: http://gerrit.cloudera.org:8080/#/c/18834/10//COMMIT_MSG@9 PS10, Line 9: table pretty ? http://gerrit.cloudera.org:8080/#/c/18834/10//COMMIT_MSG@10 PS10, Line 10: Default nit: default http://gerrit.cloudera.org:8080/#/c/18834/10//COMMIT_MSG@11 PS10, Line 11: more convenient nit: more convenient for automatic processing http://gerrit.cloudera.org:8080/#/c/18834/10//COMMIT_MSG@11 PS10, Line 11: the scenario of large-scale cluster int: in case of large-scale clusters http://gerrit.cloudera.org:8080/#/c/18834/10//COMMIT_MSG@16 PS10, Line 16: e-Id: pretty http://gerrit.cloudera.org:8080/#/c/18834/10//COMMIT_MSG@52 PS10, Line 52: nit: maybe, create a table with less tablets to have more compact example in the commit description -- it might be something like 4 tablets: 2 ranges each hash-partitioned into 2 buckets http://gerrit.cloudera.org:8080/#/c/18834/7/src/kudu/tools/tool_action_table.cc File src/kudu/tools/tool_action_table.cc: http://gerrit.cloudera.org:8080/#/c/18834/7/src/kudu/tools/tool_action_table.cc@251 PS7, Line 251: static string ToTableFormat(const TablesInfoPB& tables_info) { > The reason for adding the format param is to facilitate the collection of J I guess DataTable might help, but it requires figuring out some pre-defined structure for each line of the output, IIRC. With the list of tablet replicas it's a bit different -- rows for tablets and replicas have different structure. http://gerrit.cloudera.org:8080/#/c/18834/10/src/kudu/tools/tool_action_table.cc File src/kudu/tools/tool_action_table.cc: http://gerrit.cloudera.org:8080/#/c/18834/10/src/kudu/tools/tool_action_table.cc@151 PS10, Line 151: "One of 'json', ' That's about the output format for tablets, right? Maybe, let's then name this '--list_tablets_format', especially given that the output for tablets is toggled on/off by the '--list_tablets' flag? http://gerrit.cloudera.org:8080/#/c/18834/10/src/kudu/tools/tool_action_table.cc@155 PS10, Line 155: if (!iequals(FLAGS_list_table_output, "table") && !iequals(FLAGS_list_table_output, "json") : && !iequals(FLAGS_list_table_output, "json_compact")) { : LOG(ERROR) << Substitute("--list_table_output should be one of 'json', 'json_compact'" : " or 'table'."); : return false; : } : return true; : } : : GROUP_FLAG_VALIDATOR(list_table_output, ValidateListTableOutput); : Since this validator involves only a single flag, you don't need to have GROUP_FLAG_VALIDATOR() here, just define standard google flag validator using the DEFINE_validator() macro. You could find examples in tool_action_cluster.cc and other files under the 'tools' sub-directory. Or the idea was to check the setting for the --list_tablets flag along with the format? http://gerrit.cloudera.org:8080/#/c/18834/10/src/kudu/tools/tool_action_table.cc@256 PS10, Line 256: continue; : } : i When is it possible to have no name/id for a table? Would be great to add a comment to explain. http://gerrit.cloudera.org:8080/#/c/18834/10/src/kudu/tools/tool_action_table.cc@260 PS10, Line 260: nit: is it possible to rely on !output.empty() instead? http://gerrit.cloudera.org:8080/#/c/18834/10/src/kudu/tools/tool_action_table.cc@261 PS10, Line 261: ble_inf nit: I guess it's possible to drop conversion to string and rely on std::string's operators? http://gerrit.cloudera.org:8080/#/c/18834/10/src/kudu/tools/tool_action_table.cc@265 PS10, Line 265: string(" live_row_count:") + std::to_string(table_info.live_row_count()); : } : Instead, is it possible to use strings::Substitute() to build the string to append to 'output'? http://gerrit.cloudera.org:8080/#/c/18834/10/src/kudu/tools/tool_action_table.cc@271 PS10, Line 271: } : output += string("\n") + string(" T ") + tablet_info.tablet_id(); : i When is it possible to have a situation when no identifier for a tablet is present? It would be great to add a comment to clarify. http://gerrit.cloudera.org:8080/#/c/18834/10/src/kudu/tools/tool_action_table.cc@283 PS10, Line 283: string(" ") + replica_info.uuid() + : string(" ") + replica_info.host_port(); : } : Instead, is it possible to use strings::Substitute() to build the string to append to 'output'? -- To view, visit http://gerrit.cloudera.org:8080/18834 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I3aaec73e18872fc93646e9c0ea675b578b0702f0 Gerrit-Change-Number: 18834 Gerrit-PatchSet: 7 Gerrit-Owner: KeDeng <[email protected]> Gerrit-Reviewer: Abhishek Chennaka <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: KeDeng <[email protected]> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Mahesh Reddy <[email protected]> Gerrit-Reviewer: Yingchun Lai <[email protected]> Gerrit-Comment-Date: Fri, 26 Aug 2022 00:09:04 +0000 Gerrit-HasComments: Yes
