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

distsql: use a more accurate type of the context of distsql #51618

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

YangKeao
Copy link
Member

@YangKeao YangKeao commented Mar 8, 2024

What problem does this PR solve?

Issue Number: close #51617

Problem Summary:

The distsql only needs a subset of the whole session variables and context, so we can use a more accurate type to represent it. This refactor will help us to clone it in the future.

What changed and how does it work?

  1. Give a struct DistSQLContext, which contains all information needed by the session.
  2. Add a cache on the StmtCtx, because the cache should be invalidated after each execution.
  3. Remove the dependency of stmtctx (and session, maybe) from distsql.

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.
      It should be covered by existing tests. Some tests also need to be modified.

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

None

Copy link

ti-chi-bot bot commented Mar 8, 2024

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 release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Mar 8, 2024
Copy link

tiprow bot commented Mar 8, 2024

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 size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 8, 2024
@YangKeao
Copy link
Member Author

/retest

@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch from 5b19b9e to 463105d Compare March 12, 2024 15:00
@YangKeao
Copy link
Member Author

/retest

Copy link

codecov bot commented Mar 12, 2024

Codecov Report

Merging #51618 (c201821) into master (db0d581) will decrease coverage by 0.0186%.
Report is 2 commits behind head on master.
The diff coverage is 92.2509%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #51618        +/-   ##
================================================
- Coverage   70.7391%   70.7205%   -0.0186%     
================================================
  Files          1491       1563        +72     
  Lines        440448     460337     +19889     
================================================
+ Hits         311569     325553     +13984     
- Misses       109378     114159      +4781     
- Partials      19501      20625      +1124     
Flag Coverage Δ
integration 47.5936% <83.0258%> (?)
unit 70.4693% <88.5608%> (-0.0948%) ⬇️

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

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 51.4973% <ø> (+5.6847%) ⬆️

@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch from 463105d to 1526135 Compare March 12, 2024 15:39
@YangKeao
Copy link
Member Author

/retest

@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch from 1526135 to 48c8112 Compare March 14, 2024 08:07
@YangKeao
Copy link
Member Author

/retest

@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch from 48c8112 to 79669c2 Compare March 14, 2024 08:50
@YangKeao
Copy link
Member Author

/retest

1 similar comment
@YangKeao
Copy link
Member Author

/retest

@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch from 1d19298 to c1bec69 Compare March 14, 2024 15:48
@YangKeao
Copy link
Member Author

/retest

@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch from c1bec69 to ba4717a Compare March 15, 2024 05:49
@YangKeao
Copy link
Member Author

/retest

pkg/executor/adapter.go Outdated Show resolved Hide resolved
@YangKeao YangKeao marked this pull request as ready for review March 15, 2024 06:48
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 15, 2024
@YangKeao YangKeao requested a review from lcwangchao March 15, 2024 06:49
@YangKeao YangKeao marked this pull request as draft March 15, 2024 06:55
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 15, 2024
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Mar 18, 2024
@lcwangchao lcwangchao self-requested a review March 18, 2024 04:05
@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch 2 times, most recently from 5f41f42 to fd4b52f Compare March 25, 2024 06:53
@YangKeao YangKeao marked this pull request as ready for review March 25, 2024 06:53
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 25, 2024
@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch from fd4b52f to 4e7a8f9 Compare March 25, 2024 07:10
@YangKeao
Copy link
Member Author

/retest

@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch from 4e7a8f9 to 06eec5f Compare March 26, 2024 06:04
@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch from 06eec5f to 8c41e7f Compare March 26, 2024 06:37
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 26, 2024
Copy link

ti-chi-bot bot commented Mar 26, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-03-18 04:05:45.861737822 +0000 UTC m=+1263172.883984208: ☑️ agreed by lcwangchao.
  • 2024-03-26 06:39:05.530649646 +0000 UTC m=+1963572.552896033: ☑️ agreed by zimulala.

@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch from 8c41e7f to 902a01b Compare March 26, 2024 07:24
@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch from 902a01b to b0c1857 Compare March 28, 2024 03:42
@YangKeao YangKeao requested a review from XuHuaiyu March 28, 2024 03:48
@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 29, 2024
@YangKeao YangKeao force-pushed the migrate-distsql-ctx branch from b0c1857 to c201821 Compare April 1, 2024 06:36
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 1, 2024
Copy link

tiprow bot commented Apr 1, 2024

@YangKeao: 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 c201821 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/test-infra repository. I understand the commands that are listed here.

Copy link

ti-chi-bot bot commented Apr 1, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lcwangchao, XuHuaiyu, zimulala

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 Apr 1, 2024
@ti-chi-bot ti-chi-bot bot merged commit f7d66f4 into pingcap:master Apr 1, 2024
21 of 23 checks passed
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use a more accurate DistSQLContext to avoid depending on the whole session variables
4 participants