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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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 from eee013c to eb80955 Compare September 20, 2024 08:48
…; 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 eb80955 to 016d885 Compare September 20, 2024 14:23
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]

fail : 4 / 18 (22.22%)

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/common/greplog.cpp 0 4 00.00% [36, 40, 183, 209]
🔵 be/src/script/script.cpp 1 10 10.00% [360, 361, 362, 363, 365, 366, 367, 368, 369]
🔵 be/src/exec/pipeline/pipeline_driver_executor.cpp 3 3 100.00% []

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
1 participant