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

infoschema: use maps.Clone to replace iterating #54581

Merged
merged 7 commits into from
Jul 12, 2024

Conversation

D3Hunter
Copy link
Contributor

@D3Hunter D3Hunter commented Jul 11, 2024

What problem does this PR solve?

Issue Number: ref #54436

Problem Summary:

What changed and how does it work?

  • in https://go-review.googlesource.com/c/go/+/471400, maps.Clone is optimized to clone underlying buckets, not iterating each item as before. our info schema load part is the perfect place for this
  • remove the Reload inside OnChangedof DefaultCallback which is used in normal code path, we have already waited each instance to reload, no need to call it again, will remove it in later refactor. reload inside OnSchemaStateChanged is for test, but i don't see the need to do so, as we have waited schema change before this call, so remove it too. And as fast-create depends on reload after DDL execution, we add a reload for it separately

    tidb/pkg/ddl/job_table.go

    Lines 625 to 636 in a490882

    if err = waitSchemaChanged(wk.ctx, s.ddlCtx, s.lease*2, schemaVer, job); err != nil {
    return err
    }
    s.cleanMDLInfo(job, ownerID)
    s.synced(job)
    if RunInGoTest {
    // s.mu.hook is initialed from domain / test callback, which will force the owner host update schema diff synchronously.
    s.mu.RLock()
    s.mu.hook.OnSchemaStateChanged(schemaVer)
    s.mu.RUnlock()
    }

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

same test as in #54438, run 3 times, takes 22m30/21m40/20m44. unlike prev PR, the speed is quite stable.

compare the time to load schema diff, before
image
after
img_v3_02cm_0b13db42-e823-43bc-a792-8f0df25baccg

  • 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

@ti-chi-bot ti-chi-bot bot added 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. labels Jul 11, 2024
Copy link

tiprow bot commented Jul 11, 2024

Hi @D3Hunter. 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.

@D3Hunter D3Hunter mentioned this pull request Jul 11, 2024
74 tasks
lance6716
lance6716 previously approved these changes Jul 11, 2024
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 11, 2024
@D3Hunter
Copy link
Contributor Author

@lance6716 also check this commit a4fc016

tangenta
tangenta previously approved these changes Jul 12, 2024
@ti-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 12, 2024
Copy link

ti-chi-bot bot commented Jul 12, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-11 09:34:06.419457355 +0000 UTC m=+522943.654691468: ☑️ agreed by lance6716.
  • 2024-07-12 01:27:34.728013784 +0000 UTC m=+580151.963247897: ☑️ agreed by tangenta.

Copy link

tiprow bot commented Jul 12, 2024

@D3Hunter: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
fast_test_tiprow a4fc016 link true /test fast_test_tiprow

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@D3Hunter
Copy link
Contributor Author

/hold

wait ci

@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 Jul 12, 2024
@ti-chi-bot ti-chi-bot bot removed the approved label Jul 12, 2024
@D3Hunter
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 Jul 12, 2024
Copy link

codecov bot commented Jul 12, 2024

Codecov Report

Attention: Patch coverage is 88.88889% with 5 lines in your changes missing coverage. Please review.

Project coverage is 55.4584%. Comparing base (749d303) to head (e90e8a7).
Report is 9 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54581         +/-   ##
=================================================
- Coverage   74.8731%   55.4584%   -19.4147%     
=================================================
  Files          1549       1664        +115     
  Lines        362122     605459     +243337     
=================================================
+ Hits         271132     335778      +64646     
- Misses        71455     247334     +175879     
- Partials      19535      22347       +2812     
Flag Coverage Δ
integration 34.9900% <73.3333%> (?)
unit 71.7833% <90.9090%> (-2.0180%) ⬇️

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

Components Coverage Δ
dumpling 52.9656% <ø> (-2.2339%) ⬇️
parser ∅ <ø> (∅)
br 46.2021% <ø> (-1.4762%) ⬇️

Copy link

ti-chi-bot bot commented Jul 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tangenta

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 the approved label Jul 12, 2024
@ti-chi-bot ti-chi-bot bot merged commit 0b9cd2f into pingcap:master Jul 12, 2024
21 checks passed
@D3Hunter D3Hunter deleted the remove-reload branch July 12, 2024 07:44
@D3Hunter D3Hunter mentioned this pull request Jul 17, 2024
13 tasks
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