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

pkg/executor: refine the Executor interface #49494

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

YangKeao
Copy link
Member

@YangKeao YangKeao commented Dec 15, 2023

What problem does this PR solve?

Issue Number: close #49490

Problem Summary:

Currently, the BaseExecutor and especially BaseExecutor.Ctx() is used everywhere. We need to progressively replace BaseExecutor with some NewBaseExecutor which doesn't have a .Ctx inside. To reach this goal, I'll use several functions to replace Base() *BaseExecutor.

What changed and how does it work?

This is a simple PR. It doesn't harm the logic. It adds the following functions to the Executor interface:

	NewChunk() *chunk.Chunk
	NewChunkWithCapacity(fields []*types.FieldType, capacity int, maxCachesize int) *chunk.Chunk

	RuntimeStats() *execdetails.BasicRuntimeStats

	HandleSQLKillerSignal() error
	RegisterSQLAndPlanInExecForTopSQL()

	AllChildren() []Executor

Each executor can still use the sctx inside itself by calling .BaseExecutor.Ctx(), because they have the accurate type of themselves. It enables us to migrate some executors which don't actually use BaseExecutor.

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.
    • Refractor. It should be covered by existing test.

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

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked 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. and removed do-not-merge/needs-tests-checked labels Dec 15, 2023
@YangKeao YangKeao requested a review from lcwangchao December 15, 2023 06:39
Copy link

codecov bot commented Dec 15, 2023

Codecov Report

Merging #49494 (abe5fdc) into master (47d460f) will increase coverage by 0.6767%.
Report is 22 commits behind head on master.
The diff coverage is 88.8888%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #49494        +/-   ##
================================================
+ Coverage   70.9993%   71.6760%   +0.6767%     
================================================
  Files          1368       1420        +52     
  Lines        399557     419356     +19799     
================================================
+ Hits         283683     300578     +16895     
- Misses        96070     100043      +3973     
+ Partials      19804      18735      -1069     
Flag Coverage Δ
integration 44.2447% <88.8888%> (?)
unit 70.9971% <ø> (-0.0023%) ⬇️

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

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

@YangKeao YangKeao requested a review from xhebox December 18, 2023 07:39
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 19, 2023
Copy link

ti-chi-bot bot commented Dec 19, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lcwangchao, xhebox

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 Dec 19, 2023
Copy link

ti-chi-bot bot commented Dec 19, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-12-19 03:45:45.468997759 +0000 UTC m=+932636.506224689: ☑️ agreed by xhebox.
  • 2023-12-19 07:05:01.061711411 +0000 UTC m=+944592.098938338: ☑️ agreed by lcwangchao.

@YangKeao
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit b850d26 into pingcap:master Dec 19, 2023
16 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/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.

Remove the Base() *BaseExecutor function from Executor interface
3 participants