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

plan, executor: check b.err after buildSort and buildLimit in builUnion #7114

Merged
merged 2 commits into from
Jul 21, 2018

Conversation

XuHuaiyu
Copy link
Contributor

@XuHuaiyu XuHuaiyu commented Jul 20, 2018

What have you changed? (mandatory)

Before this commit, b.err is not checked after buildSort and buildLimit in buildUnion.

What is the type of the changes? (mandatory)

  • Bug fix (non-breaking change which fixes an issue)

How has this PR been tested? (mandatory)

integration test

Does this PR affect documentation (docs/docs-cn) update? (mandatory)

no

Does this PR need to be added to the release notes? (mandatory)

no

Refer to a related PR or issue link (optional)

Benchmark result if necessary (optional)

Add a few positive/negative examples (optional)

@XuHuaiyu XuHuaiyu added type/bugfix This PR fixes a bug. sig/planner SIG: Planner labels Jul 20, 2018
@XuHuaiyu XuHuaiyu added this to the 2.1 milestone Jul 20, 2018
@shenli
Copy link
Member

shenli commented Jul 20, 2018

LGTM

@shenli
Copy link
Member

shenli commented Jul 20, 2018

/run-all-tests

@shenli shenli added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 20, 2018
if b.err != nil {
b.err = errors.Trace(b.err)
return nil
}
Copy link
Contributor

@lysu lysu Jul 20, 2018

Choose a reason for hiding this comment

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

I have an idea how about extract this part to this style.

package main

import (
	"github.com/juju/errors"
	"fmt"
)

type builder struct {
	err error
}

func (b *builder) b1() {
	b.b2()
	b.traceSelfCallStack()
	return
}

func (b *builder) b2() {
	b.err = errors.New("111")
	return
}

func (b *builder) traceSelfCallStack() {
	if b.err == nil {
		return
	}
	err := errors.NewErrWithCause(b.err, "")
	err.SetLocation(2)
	b.err = &err
	return
}

and still, keep every builder self-call has a b.traceSelfCallStack() followed..(we have no generic, so we can not b.selfCall(b.b2)() which is more readable)

Copy link
Contributor

@lysu lysu 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 added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 20, 2018
@lysu
Copy link
Contributor

lysu commented Jul 20, 2018

/run-integration-ddl-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants