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

util/ranger: move cut prefix logic for prefix index to ealier stage #48582

Merged

Conversation

time-and-fate
Copy link
Member

@time-and-fate time-and-fate commented Nov 14, 2023

What problem does this PR solve?

Issue Number: ref #48181

What is changed and how it works?

This is part of the prerequisite to implement #48181.

Current logic:

  1. First, build expressions into points, which will be further built into Ranges.
  2. Some type conversion works and build points into Ranges.
  3. Cut prefix on Ranges.

However, to implement #48181, we need to convert strings into sort key when building points, while cutting prefix require the original value (because prefix length is calculated by characters instead of bytes).

Therefore, we have to move the cutting prefix logic to an earlier stage, into the points builder.

Fortunately, cutting prefix on points is similar to cutting on Range. And other existing logic (appending points into ranges, reserving a selection, etc,) will take care of other things.

Side effects

To eliminate possible overlapped ranges after cutting prefix, a UnionRange is needed.
Previously, we only do this when a cut actually happens. That's easy to implement because they are at the same place in the code.
Now, they are in different stages in code logic. So we always do UnionRange for prefix index, even if the cut doesn't happen. (We think UnionRange is a safe operation, and it doesn't affect the correctness)
This will result in a side effect, ranges like ['a' 1, 'a' 1], ['a' 2, 'a' 2], ['a' 3, 'a' 3] will become ['a' 1, 'a' 3]. This doesn't affect correctness but has some subtle influence on estimation and performance.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Copy link

ti-chi-bot bot commented Nov 14, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. labels Nov 14, 2023
Copy link

tiprow bot commented Nov 14, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 14, 2023
@time-and-fate
Copy link
Member Author

/test all

Copy link

codecov bot commented Nov 14, 2023

Codecov Report

Merging #48582 (18219ac) into master (9cf638f) will increase coverage by 1.6933%.
Report is 35 commits behind head on master.
The diff coverage is 93.8461%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #48582        +/-   ##
================================================
+ Coverage   71.0083%   72.7016%   +1.6933%     
================================================
  Files          1367       1392        +25     
  Lines        404865     420557     +15692     
================================================
+ Hits         287488     305752     +18264     
+ Misses        97372      95754      -1618     
+ Partials      20005      19051       -954     
Flag Coverage Δ
integration 44.8019% <93.8461%> (?)
unit 71.0126% <93.8461%> (+0.0043%) ⬆️

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

Components Coverage Δ
dumpling 53.9663% <ø> (ø)
parser ∅ <ø> (∅)
br 48.4211% <ø> (-4.6558%) ⬇️

@time-and-fate
Copy link
Member Author

/test all

@time-and-fate
Copy link
Member Author

/retest

@time-and-fate
Copy link
Member Author

/test all

@time-and-fate
Copy link
Member Author

/retest

1 similar comment
@time-and-fate
Copy link
Member Author

/retest

@time-and-fate
Copy link
Member Author

/retest

@time-and-fate
Copy link
Member Author

/test check-dev2

Copy link

tiprow bot commented Nov 22, 2023

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test check-dev2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@time-and-fate
Copy link
Member Author

/retest

@time-and-fate
Copy link
Member Author

/test unit-test

Copy link

tiprow bot commented Nov 22, 2023

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@time-and-fate
Copy link
Member Author

/test unit-test

Copy link

tiprow bot commented Nov 22, 2023

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@time-and-fate
Copy link
Member Author

/test unit-test

Copy link

tiprow bot commented Nov 22, 2023

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 24, 2023
@time-and-fate time-and-fate removed needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. labels Nov 24, 2023
Copy link

ti-chi-bot bot commented Nov 28, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tangenta, winoros

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 28, 2023
Copy link

ti-chi-bot bot commented Nov 28, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-11-24 07:30:49.988764532 +0000 UTC m=+562278.653990738: ☑️ agreed by winoros.
  • 2023-11-28 07:32:14.822279263 +0000 UTC m=+907963.487505456: ☑️ agreed by tangenta.

@time-and-fate
Copy link
Member Author

/test unit-test

Copy link

tiprow bot commented Nov 28, 2023

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@time-and-fate
Copy link
Member Author

/test unit-test

Copy link

tiprow bot commented Nov 28, 2023

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@time-and-fate
Copy link
Member Author

/test unit-test

Copy link

tiprow bot commented Nov 28, 2023

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@time-and-fate
Copy link
Member Author

/test unit-test

Copy link

tiprow bot commented Nov 28, 2023

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@time-and-fate
Copy link
Member Author

/test check-dev2

Copy link

tiprow bot commented Nov 28, 2023

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test check-dev2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@time-and-fate
Copy link
Member Author

/test unit-test

Copy link

tiprow bot commented Nov 28, 2023

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@time-and-fate
Copy link
Member Author

/test unit-test

Copy link

tiprow bot commented Nov 28, 2023

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot merged commit 909522a into pingcap:master Nov 28, 2023
16 checks passed
time-and-fate added a commit to time-and-fate/tidb that referenced this pull request Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants