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

Lightning: fix performance regression introduced by behavior change of columnAPI.Cols() #59529

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

OliverS929
Copy link
Contributor

@OliverS929 OliverS929 commented Feb 13, 2025

What problem does this PR solve?

Issue Number: close #56705

Problem Summary:

Cached the result of columnAPI.Cols() in Encoder so that it could be repeatably used in encoding.

What changed and how does it work?

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.
    • The original test cases were able to cover the change.

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

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/cherry-pick-not-approved cherry-pick-approved Cherry pick PR approved by release team. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed do-not-merge/cherry-pick-not-approved labels Feb 13, 2025
Copy link

tiprow bot commented Feb 13, 2025

Hi @OliverS929. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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-sigs/prow repository.

Copy link

codecov bot commented Feb 14, 2025

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Please upload report for BASE (release-6.5@57b9e4b). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-6.5     #59529   +/-   ##
================================================
  Coverage               ?   73.6837%           
================================================
  Files                  ?       1098           
  Lines                  ?     354162           
  Branches               ?          0           
================================================
  Hits                   ?     260960           
  Misses                 ?      76502           
  Partials               ?      16700           

@OliverS929
Copy link
Contributor Author

@D3Hunter @lance6716 Please help take a look.

@Benjamin2037
Copy link
Collaborator

Please add test cases.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 14, 2025
@D3Hunter D3Hunter changed the title Lightning: Cache result of columnAPI.Cols() for performance improvement Lightning: fix performance regression introduced by behavior change of columnAPI.Cols() Feb 14, 2025
@D3Hunter
Copy link
Contributor

D3Hunter commented Feb 14, 2025

maybe add some manual test about performance, to make sure it works as expected, before vs after

@D3Hunter
Copy link
Contributor

D3Hunter commented Feb 14, 2025

/hold

you can unhold youself after test

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 14, 2025
Copy link

ti-chi-bot bot commented Feb 14, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter, lance6716

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 Feb 14, 2025
Copy link

ti-chi-bot bot commented Feb 14, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-02-14 02:58:06.240014792 +0000 UTC m=+584528.636236849: ☑️ agreed by D3Hunter.
  • 2025-02-14 03:23:22.575371357 +0000 UTC m=+586044.971593419: ☑️ agreed by lance6716.

@tangenta tangenta removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 17, 2025
@tangenta
Copy link
Contributor

/unhold

@lance6716
Copy link
Contributor

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 17, 2025
@OliverS929
Copy link
Contributor Author

OliverS929 commented Feb 17, 2025

Manual test completed to verify the effectiveness of this commit:

  • Testing cluster configuration: 1 TiDB, 1 TiKV, 1 PD. All on v6.5.11.
  • Test setup: A table with 500 INT(11) columns, imported using a CSV file containing 100k rows of randomly generated integers.
  • Test comparison: using tidb-lightning from the original 6.5.11 mirror (before fix) and tidb-lightning manual built with this commit.
  • Test result:
    • Before fix, the encoding progress takes more than 133 seconds:image
    • After fix, the encoding progress only takes 9 seconds:
      image

Please help take a look @D3Hunter @tangenta @lance6716.

Since the testing result is as expected, I am going to unhold this PR for now. Please feel free to put this PR on hold if you feel more testing is needed.

@OliverS929
Copy link
Contributor Author

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 17, 2025
@OliverS929
Copy link
Contributor Author

/retest

Copy link

tiprow bot commented Feb 17, 2025

@OliverS929: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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-sigs/prow repository.

@OliverS929
Copy link
Contributor Author

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Feb 17, 2025
@ti-chi-bot ti-chi-bot bot merged commit e4df874 into pingcap:release-6.5 Feb 17, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants