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

executor: remove childrenResult from baseExecutor #7076

Merged
merged 7 commits into from
Jul 18, 2018
Merged

executor: remove childrenResult from baseExecutor #7076

merged 7 commits into from
Jul 18, 2018

Conversation

lysu
Copy link
Contributor

@lysu lysu commented Jul 17, 2018

What have you changed? (mandatory)

This is 1 of 3 PRs of "reduce chunk capacity". issue ref #7077

In this PR, we remove childrenResult from baseExecutor and push down them to real implements

only create result chunk for children only when it's really needed, and try create single chunk if no needed to use more than one.

What is the type of the changes? (mandatory)

  • Improvement (non-breaking change which is an improvement to an existing feature), only code refactor.

How has this PR been tested? (mandatory)

  • unit tests
  • integration tests

This change is Reviewable

@lysu
Copy link
Contributor Author

lysu commented Jul 17, 2018

/run-all-tests

@lysu lysu added the sig/execution SIG execution label Jul 17, 2018
@@ -795,6 +801,15 @@ func (e *StreamAggExec) Open(ctx context.Context) error {
return nil
}

// Close implements the Executor Close interface.
func (e *StreamAggExec) Close() error {
if err := e.baseExecutor.Close(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

We could firstly release the resources handled by itself, then release the resources handled by its children.

@@ -216,6 +225,9 @@ func (e *ProjectionExec) prepare(ctx context.Context) {

// Close implements the Executor Close interface.
func (e *ProjectionExec) Close() error {
if e.isUnparallelExec() {
Copy link
Contributor

Choose a reason for hiding this comment

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

why we need this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it paired for Open. It seems that alloc/dealloc child result chunk is required only when isUnparallel==true

@XuHuaiyu
Copy link
Contributor

/run-integration-common-test

@XuHuaiyu XuHuaiyu added the type/enhancement The issue or PR belongs to an enhancement. label Jul 17, 2018
@XuHuaiyu XuHuaiyu added this to the 2.1 milestone Jul 17, 2018
@shenli
Copy link
Member

shenli commented Jul 17, 2018

Is there a related issue about this PR?

@shenli
Copy link
Member

shenli commented Jul 17, 2018

/run-integration-common-test

@zz-jason
Copy link
Member

LGTM

lysu added 2 commits July 18, 2018 13:17
remove childrenResult from baseExecutor and push down them to real implements if they real need children chunk. cut off useless childrenResult and childResult slice alloc.
Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

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

rest LGTM

// Close implements the Executor Close interface.
func (e *StreamAggExec) Close() error {
e.childResult = nil
if err := e.baseExecutor.Close(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

return errors.Trace(e.baseExecutor.Close())   // I prefer this.

or

err := e.baseExecutor.Close()
return errors.Trace(err)

@XuHuaiyu XuHuaiyu added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 18, 2018
// Close implements the Executor Close interface.
func (e *LimitExec) Close() error {
e.childResult = nil
if err := errors.Trace(e.baseExecutor.Close()); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

You could just return it. It's ok not to have this if branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is what I mean in the previous comments.😂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done 😂😂

// Close implements the Executor Close interface.
func (e *ExistsExec) Close() error {
e.childResult = nil
if err := errors.Trace(e.baseExecutor.Close()); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

ditto.

Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

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

LGTM

@lysu lysu merged commit 4f16bdd into pingcap:master Jul 18, 2018
@lysu lysu deleted the dev/remove_childrenResult_from_baseExecutor branch September 27, 2018 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution status/LGT1 Indicates that a PR has LGTM 1. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants