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

[BugFix] Fix duplicate entries in be_logs; Add reset_delvec in script; Add BE id in error message when query failed #51204

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

decster
Copy link
Contributor

@decster decster commented Sep 20, 2024

Why I'm doing:

Their are duplicate entries when using be_logs with '.*' parttern.
There is no be ID in error message when query failed.

What I'm doing:

Fix regex match bug in greplog;
Add BE id in error message;
Add a tool to fix corrupted metadata causing "no delete vector found" error;

Fixes #51190

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

@@ -553,6 +566,7 @@ class StorageEngineRef {
REG_STATIC_METHOD(StorageEngineRef, get_tablet_info);
REG_STATIC_METHOD(StorageEngineRef, get_tablet_infos);
REG_STATIC_METHOD(StorageEngineRef, get_tablet_meta_json);
REG_STATIC_METHOD(StorageEngineRef, reset_delvec);
REG_STATIC_METHOD(StorageEngineRef, get_tablet);
REG_STATIC_METHOD(StorageEngineRef, drop_tablet);
REG_STATIC_METHOD(StorageEngineRef, get_data_dirs);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The most risky bug in this code is:
Potential null pointer dereference in reset_delvec method when tablet->data_dir() returns null. This could cause a segmentation fault.

You can modify the code like this:

static std::string reset_delvec(int64_t tablet_id, int64_t segment_id, int64_t version) {
    auto tablet = get_tablet(tablet_id);
    if (!tablet) {
        return "tablet not found";
    }
    auto data_dir = tablet->data_dir();
    if (!data_dir) {
        return "data directory not found";
    }
    DelVector dv;
    dv.init(version, nullptr, 0);
    auto st = TabletMetaManager::set_del_vector(data_dir->get_meta(), tablet_id, segment_id, dv);
    return st.to_string();
}

@decster decster force-pushed the bugfix-duplog-resetdelvec-showbeid branch 6 times, most recently from 4756897 to ff08798 Compare September 24, 2024 05:19
@decster decster requested a review from a team as a code owner September 24, 2024 05:19
@decster decster force-pushed the bugfix-duplog-resetdelvec-showbeid branch from ff08798 to 6ec4e42 Compare September 24, 2024 07:31
be/src/common/greplog.cpp Outdated Show resolved Hide resolved
be/src/exec/pipeline/pipeline_driver_executor.cpp Outdated Show resolved Hide resolved
be/src/http/action/greplog_action.cpp Show resolved Hide resolved
@decster decster force-pushed the bugfix-duplog-resetdelvec-showbeid branch from 6ec4e42 to a22628a Compare September 24, 2024 09:56
@decster decster requested a review from a team as a code owner September 24, 2024 09:56
…; Add BE id in error message when query failed

Signed-off-by: Binglin Chang <[email protected]>
@decster decster force-pushed the bugfix-duplog-resetdelvec-showbeid branch from a22628a to fb23b0e Compare September 24, 2024 09:57
Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[BE Incremental Coverage Report]

pass : 25 / 28 (89.29%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/exec/schema_scanner/schema_be_logs_scanner.cpp 0 1 00.00% [51]
🔵 be/src/http/action/greplog_action.cpp 0 1 00.00% [69]
🔵 be/src/common/greplog.cpp 8 9 88.89% [186]
🔵 be/src/exec/pipeline/pipeline_driver_executor.cpp 3 3 100.00% []
🔵 be/src/script/script.cpp 9 9 100.00% []
🔵 be/src/service/backend_options.cpp 4 4 100.00% []
🔵 be/src/service/service_be/starrocks_be.cpp 1 1 100.00% []

@decster decster merged commit 52c55f9 into StarRocks:main Sep 24, 2024
55 of 56 checks passed
Copy link

@Mergifyio backport branch-3.3

@github-actions github-actions bot removed the 3.3 label Sep 24, 2024
Copy link
Contributor

mergify bot commented Sep 24, 2024

backport branch-3.0

✅ Backports have been created

Copy link
Contributor

mergify bot commented Sep 24, 2024

backport branch-2.5

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (#51204)

Signed-off-by: Binglin Chang <[email protected]>
(cherry picked from commit 52c55f9)

# Conflicts:
#	be/src/common/greplog.cpp
#	be/src/service/backend_options.h
#	be/test/storage/tablet_updates_test.cpp
#	test/sql/test_array_fn/R/test_array_sortby
#	test/sql/test_dict_mapping_function/R/test_dict_mapping_function
#	test/sql/test_dictionary/R/test_dictionary
#	test/sql/test_external_file/R/test_orc_predicates
#	test/sql/test_group_execution/R/test_group_execution_join
#	test/sql/test_inverted_index/R/test_inverted_index
#	test/sql/test_json/R/to_json
#	test/sql/test_string_functions/R/test_string_functions
mergify bot pushed a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (#51204)

Signed-off-by: Binglin Chang <[email protected]>
(cherry picked from commit 52c55f9)
mergify bot pushed a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (#51204)

Signed-off-by: Binglin Chang <[email protected]>
(cherry picked from commit 52c55f9)

# Conflicts:
#	be/src/service/backend_options.h
#	test/sql/test_array_fn/R/test_array_sortby
#	test/sql/test_dictionary/R/test_dictionary
#	test/sql/test_external_file/R/test_orc_predicates
#	test/sql/test_group_execution/R/test_group_execution_join
#	test/sql/test_inverted_index/R/test_inverted_index
#	test/sql/test_json/R/to_json
#	test/sql/test_string_functions/R/test_string_functions
mergify bot pushed a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (#51204)

Signed-off-by: Binglin Chang <[email protected]>
(cherry picked from commit 52c55f9)

# Conflicts:
#	be/src/common/greplog.cpp
#	be/src/exec/pipeline/pipeline_driver_executor.cpp
#	be/src/script/script.cpp
#	be/src/service/backend_options.h
#	be/src/service/service_be/starrocks_be.cpp
#	be/test/storage/tablet_updates_test.cpp
#	test/sql/test_array_fn/R/test_array_fn
#	test/sql/test_array_fn/R/test_array_sortby
#	test/sql/test_decimal/R/test_decimal_overflow
#	test/sql/test_dict_mapping_function/R/test_dict_mapping_function
#	test/sql/test_dictionary/R/test_dictionary
#	test/sql/test_external_file/R/test_orc_predicates
#	test/sql/test_function/R/test_time_slice
#	test/sql/test_generate_series/R/test_generate_series
#	test/sql/test_group_execution/R/test_group_execution_join
#	test/sql/test_inverted_index/R/test_inverted_index
#	test/sql/test_json/R/to_json
#	test/sql/test_string_functions/R/test_string_functions
#	test/sql/test_trino_dialect/R/test_trino_dialect
#	test/sql/test_udf/R/test_jvm_udf
mergify bot pushed a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (#51204)

Signed-off-by: Binglin Chang <[email protected]>
(cherry picked from commit 52c55f9)

# Conflicts:
#	be/src/common/greplog.cpp
#	be/src/script/script.cpp
#	be/src/service/backend_options.h
#	be/src/service/service_be/starrocks_be.cpp
#	be/test/storage/tablet_updates_test.cpp
#	test/sql/test_array_fn/R/test_array_fn
#	test/sql/test_array_fn/R/test_array_sortby
#	test/sql/test_decimal/R/test_decimal_overflow
#	test/sql/test_dict_mapping_function/R/test_dict_mapping_function
#	test/sql/test_dictionary/R/test_dictionary
#	test/sql/test_external_file/R/test_orc_predicates
#	test/sql/test_function/R/test_time_slice
#	test/sql/test_generate_series/R/test_generate_series
#	test/sql/test_group_execution/R/test_group_execution_join
#	test/sql/test_inverted_index/R/test_inverted_index
#	test/sql/test_json/R/to_json
#	test/sql/test_string_functions/R/test_string_functions
#	test/sql/test_trino_dialect/R/test_trino_dialect
#	test/sql/test_udf/R/test_jvm_udf
wanpengfei-git pushed a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (backport #51204) (#51347)

Co-authored-by: Binglin Chang <[email protected]>
decster added a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (#51204)

Signed-off-by: Binglin Chang <[email protected]>
(cherry picked from commit 52c55f9)
decster added a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (#51204)

Signed-off-by: Binglin Chang <[email protected]>
(cherry picked from commit 52c55f9)
decster added a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (#51204)

Signed-off-by: Binglin Chang <[email protected]>
(cherry picked from commit 52c55f9)
decster added a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (#51204)

Signed-off-by: Binglin Chang <[email protected]>
(cherry picked from commit 52c55f9)
decster added a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (#51204)

Signed-off-by: Binglin Chang <[email protected]>
(cherry picked from commit 52c55f9)
decster added a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (#51204)

Signed-off-by: Binglin Chang <[email protected]>
(cherry picked from commit 52c55f9)
wanpengfei-git pushed a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (backport #51204) (#51348)

Co-authored-by: Binglin Chang <[email protected]>
wanpengfei-git pushed a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (backport #51204) (#51350)

Co-authored-by: Binglin Chang <[email protected]>
wanpengfei-git pushed a commit that referenced this pull request Sep 24, 2024
…; Add BE id in error message when query failed (backport #51204) (#51349)

Co-authored-by: Binglin Chang <[email protected]>
decster added a commit that referenced this pull request Sep 27, 2024
…; Add BE id in error message when query failed (#51204)

Signed-off-by: Binglin Chang <[email protected]>
(cherry picked from commit 52c55f9)
wanpengfei-git pushed a commit that referenced this pull request Sep 27, 2024
…; Add BE id in error message when query failed (backport #51204) (#51351)

Co-authored-by: Binglin Chang <[email protected]>
renzhimin7 pushed a commit to renzhimin7/starrocks that referenced this pull request Nov 7, 2024
…; Add BE id in error message when query failed (StarRocks#51204)

Signed-off-by: Binglin Chang <[email protected]>
Signed-off-by: zhiminr.ren <[email protected]>
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.

Search BE log returns repeated entries
3 participants