Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tool] fix meta_tool.sh #45587

Merged
merged 1 commit into from
May 15, 2024
Merged

[Tool] fix meta_tool.sh #45587

merged 1 commit into from
May 15, 2024

Conversation

kevincai
Copy link
Contributor

@kevincai kevincai commented May 14, 2024

  • use start_backend.sh to invoke meta_tool for common env settings
  • support showing help message if no options provided for meta_tool
  • set FLAGS_operation to empty by default, so the usage message can be shown if the user doesn't provide any parameter when invoking the tool

Why I'm doing:

What I'm doing:

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.3
    • 3.2
    • 3.1
    • 3.0
    • 2.5

@kevincai
Copy link
Contributor Author

An example of the output when running meta_tool without any parameter

meta_tool: 
  meta_tool is the StarRocks BE Meta tool.
    [CAUTION] Stop BE first before using this tool if modification will be made.

  Usage:
    get_meta:
      meta_tool --operation=get_meta --root_path=</path/to/storage/path> --tablet_id=<tabletid> [--schema_hash=<schemahash>]
    load_meta:
      meta_tool --operation=load_meta --root_path=</path/to/storage/path> --json_meta_path=<path>
    delete_meta:
      meta_tool --operation=delete_meta --root_path=</path/to/storage/path> --tablet_id=<tabletid> [--schema_hash=<schemahash>]
      meta_tool --operation=delete_meta --root_path=</path/to/storage/path> --table_id=<tableid>
      meta_tool --operation=delete_meta --tablet_file=<file_path>
    delete_rowset_meta:
      meta_tool --operation=delete_rowset_meta --root_path=</path/to/storage/path> --tablet_uid=<tablet_uid> --rowset_id=<rowset_id>
    delete_persistent_index_meta:
      meta_tool --operation=delete_persistent_index_meta --root_path=</path/to/storage/path> --tablet_id=<tabletid>
      meta_tool --operation=delete_persistent_index_meta --root_path=</path/to/storage/path> --table_id=<tableid>
    compact_meta:
      meta_tool --operation=compact_meta --root_path=</path/to/storage/path>
    get_meta_stats:
      meta_tool --operation=get_meta_stats --root_path=</path/to/storage/path>
    ls:
      meta_tool --operation=ls --root_path=</path/to/storage/path>
    show_meta:
      meta_tool --operation=show_meta --pb_meta_path=<path>
    show_segment_footer:
      meta_tool --operation=show_segment_footer --file=</path/to/segment/file>
    dump_segment_data:
      meta_tool --operation=dump_segment_data --file=</path/to/segment/file>
    dump_column_size:
      meta_tool --operation=dump_column_size --file=</path/to/segment/file>
    print_pk_dump:
      meta_tool --operation=print_pk_dump --file=</path/to/pk/dump/file>
    dump_short_key_index:
      meta_tool --operation=dump_short_key_index --file=</path/to/segment/file> --key_column_count=<2>
    calc_checksum:
      meta_tool --operation=calc_checksum [--column_index=<index>] --file=</path/to/segment/file>
    check_table_meta_consistency:
      meta_tool --operation=check_table_meta_consistency --root_path=</path/to/storage/path> --table_id=<tableid>
    scan_dcgs:
      meta_tool --operation=scan_dcgs --root_path=</path/to/storage/path> --tablet_id=<tabletid>
    print_lake_metadata:
      cat <tablet_meta_file.meta> | meta_tool --operation=print_lake_metadata
    print_lake_txn_log:
      cat <tablet_transaction_log_file.log> | meta_tool --operation=print_lake_txn_log
    print_lake_schema:
      cat <tablet_schema_file> | meta_tool --operation=print_lake_schema
    lake_datafile_gc:
      meta_tool --operation=lake_datafile_gc --root_path=<path> --expired_sec=<86400> --conf_file=<path> --audit_file=<path> --do_delete=<true|false>
    

  Flags from /build/starrocks/be/src/tools/meta_tool.cpp:
    -audit_file (audit file path) type: string default: ""
    -column_index (column index) type: int32 default: -1
    -conf_file (conf file path) type: string default: ""
    -do_delete (do delete files) type: bool default: false
    -expired_sec (expired seconds) type: int64 default: 86400
    -file (segment file path) type: string default: ""
    -json_meta_path (absolute json meta file path) type: string default: ""
    -key_column_count (key column count) type: int32 default: 0
    -operation (valid operation: get_meta, flag, load_meta, delete_meta,
      delete_rowset_meta, show_meta, check_table_meta_consistency,
      print_lake_metadata, print_lake_txn_log, print_lake_schema) type: string
      default: ""
    -pb_meta_path (pb meta file path) type: string default: ""
    -root_path (storage root path) type: string default: ""
    -rowset_id (rowset_id) type: string default: ""
    -schema_hash (schema_hash for tablet meta) type: int32 default: 0
    -table_id (table id for table meta) type: int64 default: 0
    -tablet_file (file to save a set of tablets) type: string default: ""
    -tablet_id (tablet_id for tablet meta) type: int64 default: 0
    -tablet_uid (tablet_uid for tablet meta) type: string default: ""

trueeyu
trueeyu previously approved these changes May 15, 2024
bin/start_backend.sh Outdated Show resolved Hide resolved
* use `start_backend.sh` to invoke meta_tool for common env settings
* support showing help message if no options provided for meta_tool
* set FLAGS_operation to empty by default, so the usage message can be
  shown if the user doesn't provide any parameter when invoking the tool

Signed-off-by: Kevin Xiaohua Cai <caixiaohua@starrocks.com>
Copy link

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[BE Incremental Coverage Report]

fail : 0 / 13 (00.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/tools/meta_tool.cpp 0 13 00.00% [121, 172, 176, 177, 1027, 1034, 1035, 1216, 1217, 1227, 1228, 1259, 1260]

@imay imay merged commit 2d9beba into StarRocks:main May 15, 2024
45 of 46 checks passed
@kevincai
Copy link
Contributor Author

@Mergifyio backport branch-3.3 branch-3.2 branch-3.1

Copy link
Contributor

mergify bot commented May 17, 2024

backport branch-3.3 branch-3.2 branch-3.1

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request May 17, 2024
(cherry picked from commit 2d9beba)
@mergify mergify bot mentioned this pull request May 17, 2024
42 tasks
mergify bot pushed a commit that referenced this pull request May 17, 2024
(cherry picked from commit 2d9beba)

# Conflicts:
#	be/src/tools/meta_tool.cpp
@mergify mergify bot mentioned this pull request May 17, 2024
42 tasks
mergify bot pushed a commit that referenced this pull request May 17, 2024
(cherry picked from commit 2d9beba)

# Conflicts:
#	be/src/tools/meta_tool.cpp
@mergify mergify bot mentioned this pull request May 17, 2024
42 tasks
wanpengfei-git pushed a commit that referenced this pull request May 17, 2024
Co-authored-by: Kevin Cai <caixiaohua@starrocks.com>
wanpengfei-git pushed a commit that referenced this pull request May 17, 2024
Signed-off-by: Kevin Xiaohua Cai <caixiaohua@starrocks.com>
Co-authored-by: Kevin Cai <caixiaohua@starrocks.com>
wanpengfei-git pushed a commit that referenced this pull request May 17, 2024
Signed-off-by: Kevin Xiaohua Cai <caixiaohua@starrocks.com>
Co-authored-by: Kevin Cai <caixiaohua@starrocks.com>
node pushed a commit to vivo/starrocks that referenced this pull request May 17, 2024
@kevincai kevincai deleted the fix-meta-tool branch May 17, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants