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

fix(meta): reduce time complexity of MinOverlappingPicker #14036

Merged
merged 2 commits into from
Dec 18, 2023

Conversation

Little-Wallace
Copy link
Contributor

@Little-Wallace Little-Wallace commented Dec 18, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

close #10109

When there are too many small files in base level, meta-node may cost too much time to pick one task. Because the time complexity of MinOverlappingPicker is O(N^2*k), where k represent the overlap size of next level.

But most of case could be solved by trivial move, so we can pick trivial move file at the beginning of picker. The time complexity of TrivialMovePicker is O(N*logN).

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added test labels as necessary. See details.
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@github-actions github-actions bot added the type/fix Bug fix label Dec 18, 2023
@MrCroxx MrCroxx self-requested a review December 18, 2023 06:54
level_handlers,
stats,
) {
return Some(input);
Copy link
Contributor

Choose a reason for hiding this comment

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

If there is always some SST that can be trivial-moved, will early-return here be a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is still right. Because Trivial Move task always has the smallest score(which is zero). So MinOverlappingPicker will still return the SST that can be trivial-moved at first.

Copy link
Contributor

@MrCroxx MrCroxx left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Little-Wallace <[email protected]>
@Little-Wallace Little-Wallace added this pull request to the merge queue Dec 18, 2023
Copy link

codecov bot commented Dec 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cc7c370) 68.07% compared to head (47370eb) 67.98%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14036      +/-   ##
==========================================
- Coverage   68.07%   67.98%   -0.09%     
==========================================
  Files        1542     1542              
  Lines      266904   266914      +10     
==========================================
- Hits       181682   181462     -220     
- Misses      85222    85452     +230     
Flag Coverage Δ
rust 67.98% <100.00%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Merged via the queue into main with commit 3a0592d Dec 18, 2023
36 of 37 checks passed
@Little-Wallace Little-Wallace deleted the wallace/fix-picker-complex branch December 18, 2023 08:45
github-actions bot pushed a commit that referenced this pull request Dec 18, 2023
huangjw806 pushed a commit that referenced this pull request Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(meta): optimize the complexity of MinOverlappingPicker
4 participants