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

ddl: use static contexts in NewReorgCopContext #55823

Merged
merged 3 commits into from
Sep 5, 2024

Conversation

lcwangchao
Copy link
Collaborator

@lcwangchao lcwangchao commented Sep 3, 2024

What problem does this PR solve?

Issue Number: ref #53388

What changed and how does it work?

This PR:

  • Introduces new functions newReorgExprCtxWithReorgMeta and newReorgDistSQLCtxWithReorgMeta to build ExprContext and DistSQLContext for DDL reorg.
  • Use above methods to construct static contexts in NewReorgCopContext

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

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 3, 2024
Copy link

tiprow bot commented Sep 3, 2024

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

@lcwangchao lcwangchao force-pushed the copctxstatic branch 2 times, most recently from 5ab267f to ba40b05 Compare September 3, 2024 09:58
@@ -272,6 +272,7 @@ func (c *Context) GetDistSQLCtx() *distsqlctx.DistSQLContext {
TiFlashMaxBytesBeforeExternalSort: vars.TiFlashMaxBytesBeforeExternalSort,
TiFlashMaxQueryMemoryPerNode: vars.TiFlashMaxQueryMemoryPerNode,
TiFlashQuerySpillRatio: vars.TiFlashQuerySpillRatio,
ResourceGroupName: sc.ResourceGroupName,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems ResourceGroupName is lost in the previous implementation. PTAL @YangKeao

@@ -641,8 +642,8 @@ func NewContext() *Context {
vars.MemTracker.SetBytesLimit(-1)
vars.DiskTracker.SetBytesLimit(-1)
vars.StmtCtx.MemTracker, vars.StmtCtx.DiskTracker = memory.NewTracker(-1, -1), disk.NewTracker(-1, -1)
vars.MemTracker.AttachTo(vars.MemTracker)
vars.DiskTracker.AttachTo(vars.DiskTracker)
vars.StmtCtx.MemTracker.AttachTo(vars.MemTracker)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

After discussing with @XuHuaiyu , we should use vars.StmtCtx.MemTracker here

@lcwangchao lcwangchao force-pushed the copctxstatic branch 2 times, most recently from 441d41f to b0a35ab Compare September 3, 2024 10:05
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 85.33333% with 11 lines in your changes missing coverage. Please review.

Project coverage is 57.5838%. Comparing base (eb19c10) to head (a400bfb).
Report is 19 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #55823         +/-   ##
=================================================
- Coverage   72.8613%   57.5838%   -15.2776%     
=================================================
  Files          1595       1753        +158     
  Lines        449065     647102     +198037     
=================================================
+ Hits         327195     372626      +45431     
- Misses       101574     248858     +147284     
- Partials      20296      25618       +5322     
Flag Coverage Δ
integration 40.6081% <77.2727%> (?)
unit 72.5753% <85.3333%> (+0.6376%) ⬆️

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

Components Coverage Δ
dumpling 52.9567% <ø> (+0.0266%) ⬆️
parser ∅ <ø> (∅)
br 64.0922% <ø> (+18.7166%) ⬆️

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Sep 4, 2024

@lcwangchao: 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.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Sep 4, 2024

@lcwangchao: 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.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Sep 4, 2024

@lcwangchao: 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.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 4, 2024
Copy link
Member

@YangKeao YangKeao left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Sep 5, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Sep 5, 2024
Copy link

ti-chi-bot bot commented Sep 5, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-04 09:51:39.201997945 +0000 UTC m=+438023.720050867: ☑️ agreed by tangenta.
  • 2024-09-05 01:59:04.287132378 +0000 UTC m=+496068.805185303: ☑️ agreed by YangKeao.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Sep 5, 2024

@lcwangchao: 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.

@ti-chi-bot ti-chi-bot bot merged commit edbec22 into pingcap:master Sep 5, 2024
25 checks passed
@lcwangchao lcwangchao deleted the copctxstatic branch September 5, 2024 06:46
breezewish added a commit to breezewish/tidb that referenced this pull request Sep 8, 2024
* origin/master: (33 commits)
  build(deps): bump github.com/prometheus/common from 0.55.0 to 0.57.0 (pingcap#55762)
  build(deps): bump golang.org/x/sys from 0.24.0 to 0.25.0 (pingcap#55894)
  planner: fix incorrect estRows with global index and json column (pingcap#55842)
  ddl, stat: switch to new struct for add/truncate/drop partition (pingcap#55893)
  planner: hide instance plan cache eviction log if no plan is evicted (pingcap#55918)
  expression: support tidb encode key function (pingcap#51678)
  planner: fix incorrect maintenance of `handleColHelper` for recursive CTE (pingcap#55732)
  executor: some code refine of hash join v2 (pingcap#55887)
  infoschema, meta: fix wrong auto id after `rename table` (pingcap#55847)
  ddl/ingest: set `minCommitTS` when detect remote duplicate keys (pingcap#55588)
  planner: move index advisor into the kernel (pingcap#55874)
  ddl, stats: switch to new struct for create/truncate table (pingcap#55811)
  executor: avoid new small objects in probe stage of hash join v2 (pingcap#55855)
  *: Add tidbCPU/tikvCPU into system tables (pingcap#55455)
  ddl: use static contexts in `NewReorgCopContext` (pingcap#55823)
  executor: fix index out of range bug in hash join v2 (pingcap#55864)
  executor: record index usage for the clustered primary keys (pingcap#55602)
  domain: load all non-public tables into infoschema (pingcap#55142)
  test: fix unstable TestShowViewPriv (pingcap#55868)
  ttl: add `varbinary` case for `TestSplitTTLScanRangesWithBytes` (pingcap#55863)
  ...
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants