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

planner, session: add isolation read with engine type #12997

Merged
merged 15 commits into from
Nov 1, 2019

Conversation

lzmhhh123
Copy link
Contributor

@lzmhhh123 lzmhhh123 commented Oct 29, 2019

What problem does this PR solve?

Support isolation read by engine type.

What is changed and how it works?

Filter access paths by engine type after getting all possible access paths.

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has persistent data change

Side effects

  • Increased code complexity

@codecov
Copy link

codecov bot commented Oct 29, 2019

Codecov Report

Merging #12997 into master will increase coverage by 0.0744%.
The diff coverage is 90.909%.

@@               Coverage Diff                @@
##             master     #12997        +/-   ##
================================================
+ Coverage   80.0122%   80.0866%   +0.0744%     
================================================
  Files           468        465         -3     
  Lines        109697     107757      -1940     
================================================
- Hits          87771      86299      -1472     
+ Misses        15174      14962       -212     
+ Partials       6752       6496       -256

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

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

LGTM

@lzmhhh123 lzmhhh123 added the sig/planner SIG: Planner label Oct 30, 2019
@lzmhhh123 lzmhhh123 changed the title session: add two session variables for isolation read planner, session: add isolation read with engine type Oct 30, 2019
@lzmhhh123
Copy link
Contributor Author

@lamxTyler Now we can't realize the isolation read by store label. So I change this PR. Please retake a look.

planner/core/planbuilder.go Outdated Show resolved Hide resolved
sessionctx/variable/session.go Show resolved Hide resolved
sessionctx/variable/session.go Outdated Show resolved Hide resolved
sessionctx/variable/sysvar.go Outdated Show resolved Hide resolved
sessionctx/variable/varsutil.go Outdated Show resolved Hide resolved
sessionctx/variable/varsutil.go Show resolved Hide resolved
planner/core/logical_plan_builder.go Outdated Show resolved Hide resolved
planner/core/planbuilder.go Show resolved Hide resolved
sessionctx/variable/session.go Outdated Show resolved Hide resolved

_, err = tk.Exec("select * from t")
c.Assert(err, NotNil)
c.Assert(err.Error(), Equals, "[planner:1815]Internal : Can't find a proper physical plan for this query")
Copy link
Member

Choose a reason for hiding this comment

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

The error message should be more friendly to the user. We should try our best to point out the reason and how to workaround.

formatVal += ","
}
switch {
case strings.EqualFold(engine, kv.TiKV.Name()):
Copy link
Member

Choose a reason for hiding this comment

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

should we also trim the spaces around each item and remove the duplicated items? For example, users may set the variable this way:

set @@ tidb_isolation_read_engines = "tiflash, tikv,  tiflash,    tikv";

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.

sessionctx/variable/varsutil.go Outdated Show resolved Hide resolved
planner/core/planbuilder.go Outdated Show resolved Hide resolved
Copy link
Contributor

@alivxxx alivxxx 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
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. labels Nov 1, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

@lzmhhh123 merge failed.

@lzmhhh123
Copy link
Contributor Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

@lzmhhh123 merge failed.

@zyxbest
Copy link
Contributor

zyxbest commented Nov 1, 2019

/run-mybatis-test

@lzmhhh123
Copy link
Contributor Author

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Nov 1, 2019

@lzmhhh123 merge failed.

@lzmhhh123
Copy link
Contributor Author

/run-unit-test

@lzmhhh123 lzmhhh123 merged commit 000c1ba into pingcap:master Nov 1, 2019
@lzmhhh123 lzmhhh123 deleted the dev/add_location_read_variables branch November 1, 2019 07:47
@@ -734,9 +734,9 @@ func (e *Explain) explainPlanInRowFormat(p Plan, taskType, indent string, isLast
var storeType string
switch x.StoreType {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not call Name directly?

XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
lzmhhh123 added a commit to lzmhhh123/tidb that referenced this pull request Jan 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/session sig/planner SIG: Planner status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/new-feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants