Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pingcap/tidb into fix_bit…
Browse files Browse the repository at this point in the history
…_default_value_bug
  • Loading branch information
crazycs520 committed Aug 21, 2018
2 parents f2b8579 + 1dc41d8 commit 619da40
Show file tree
Hide file tree
Showing 222 changed files with 7,087 additions and 2,988 deletions.
80 changes: 22 additions & 58 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,37 @@
Thank you for contributing to TiDB! Please read TiDB's [CONTRIBUTING](https://github.com/pingcap/tidb/blob/master/CONTRIBUTING.md) document **BEFORE** filing this PR.
-->

## What have you changed? (mandatory)
### What problem does this PR solve? <!--add issue link with summary if exists-->

<!--
Please explain **IN DETAIL** what the changes are in this PR and why they are needed:
- Summarize your change (mandatory)
- How does this PR work? Need a brief introduction for the changed logic (optional)
- Separately describe each logical change and avoid lazy messages (optional)
- Describe any limitations of the current code (optional)
Please **NOTE** that:
- Do not assume reviewers understand the original issue
-->

## What is the type of the changes? (mandatory)

<!--
The currently defined types are listed below, please pick one of the types for this PR by removing the others.
-->

- New feature (non-breaking change which adds functionality)
- Improvement (non-breaking change which is an improvement to an existing feature)
- Bug fix (non-breaking change which fixes an issue)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)

## How has this PR been tested? (mandatory)

<!--
Please describe the tests that you ran to verify your changes.
Have you finished unit tests, integration tests, or manual tests?
What additional tests would give you greater confidence in this change?
-->

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

<!--
If there is document change, please file a PR in ([docs](https://github.com/pingcap/docs) or [docs-cn](https://github.com/pingcap/docs-cn)) and add the PR number here.
-->

## Does this PR affect tidb-ansible update? (mandatory)
### What is changed and how it works?

<!--
If there is a configuration or metrics change, please file a PR in [tidb-ansible](https://github.com/pingcap/tidb-ansible), and add the PR number here.
-->

## Does this PR need to be added to the release notes? (mandatory)
### Check List <!--REMOVE the items that are not applicable-->

<!--
If this PR needs to be added to the release notes, please:
1. add the "**release-note**" label for this PR
2. write your release note in the below block
3. if the PR requires additional action from users switching to the new
release, describe the concrete action that users need to take in detail.
Tests <!-- At least one of them must be included. -->

An example:
```
release note:
// put your release notes for this PR here.
- Unit test
- Integration test
- Manual test (add detailed scripts or steps below)
- No code

action required:
// put your required action in detail here.
```
-->
Code changes

- Has exported function/method change
- Has exported variable/fields change
- Has interface methods change
- Has persistent data change

## Refer to a related PR or issue link (optional)
Side effects

## Benchmark result if necessary (optional)
- Possible performance regression
- Increased code complexity
- Breaking backward compatibility

## Add a few positive/negative examples (optional)
Related changes

- Need to cherry-pick to the release branch
- Need to update the documentation
- Need to update the `tidb-ansible` repository
- Need to be included in the release note
18 changes: 11 additions & 7 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ required = ["github.com/golang/protobuf/jsonpb"]
version = "1.1.0"
name = "github.com/golang/protobuf"

[[constraint]]
branch = "master"
name = "github.com/coreos/gofail"

[[constraint]]
branch = "master"
name = "github.com/cznic/parser"
Expand Down Expand Up @@ -92,3 +88,7 @@ required = ["github.com/golang/protobuf/jsonpb"]
[[constraint]]
name = "github.com/opentracing/basictracer-go"
version = "1.0.0"

[[constraint]]
branch = "master"
name = "github.com/etcd-io/gofail"
38 changes: 28 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@ LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBGitHash=$(shell git rev-
LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBGitBranch=$(shell git rev-parse --abbrev-ref HEAD)"
LDFLAGS += -X "github.com/pingcap/tidb/util/printer.GoVersion=$(shell go version)"

TEST_LDFLAGS = -X "github.com/pingcap/tidb/config.checkBeforeDropLDFlag=1"

CHECK_LDFLAGS += $(LDFLAGS) ${TEST_LDFLAGS}

TARGET = ""

.PHONY: all build update parser clean todo test gotest interpreter server dev benchkv benchraw check parserlib checklist

default: server buildsucc

server-admin-check: server_check buildsucc

buildsucc:
@echo Build TiDB Server successfully!

Expand Down Expand Up @@ -129,7 +135,7 @@ explaintest: server
@cd cmd/explaintest && ./run-tests.sh -s ../../bin/tidb-server

gotest: parserlib
go get github.com/coreos/gofail
go get github.com/etcd-io/gofail
@$(GOFAIL_ENABLE)
ifeq ("$(TRAVIS_COVERAGE)", "1")
@echo "Running in TRAVIS_COVERAGE mode."
Expand All @@ -141,28 +147,28 @@ ifeq ("$(TRAVIS_COVERAGE)", "1")
else
@echo "Running in native mode."
@export log_level=error; \
$(GOTEST) -cover $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; }
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' -cover $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; }
endif
@$(GOFAIL_DISABLE)

race: parserlib
go get github.com/coreos/gofail
go get github.com/etcd-io/gofail
@$(GOFAIL_ENABLE)
@export log_level=debug; \
$(GOTEST) -race $(PACKAGES)
$(GOTEST) -timeout 20m -race $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; }
@$(GOFAIL_DISABLE)

leak: parserlib
go get github.com/coreos/gofail
go get github.com/etcd-io/gofail
@$(GOFAIL_ENABLE)
@export log_level=debug; \
$(GOTEST) -tags leak $(PACKAGES)
$(GOTEST) -tags leak $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; }
@$(GOFAIL_DISABLE)

tikv_integration_test: parserlib
go get github.com/coreos/gofail
go get github.com/etcd-io/gofail
@$(GOFAIL_ENABLE)
$(GOTEST) ./store/tikv/. -with-tikv=true
$(GOTEST) ./store/tikv/. -with-tikv=true || { $(GOFAIL_DISABLE); exit 1; }
@$(GOFAIL_DISABLE)

RACE_FLAG =
Expand All @@ -171,11 +177,23 @@ ifeq ("$(WITH_RACE)", "1")
GOBUILD = GOPATH=$(GOPATH) CGO_ENABLED=1 $(GO) build
endif

CHECK_FLAG =
ifeq ("$(WITH_CHECK)", "1")
CHECK_FLAG = $(TEST_LDFLAGS)
endif

server: parserlib
ifeq ($(TARGET), "")
$(GOBUILD) $(RACE_FLAG) -ldflags '$(LDFLAGS)' -o bin/tidb-server tidb-server/main.go
$(GOBUILD) $(RACE_FLAG) -ldflags '$(LDFLAGS) $(CHECK_FLAG)' -o bin/tidb-server tidb-server/main.go
else
$(GOBUILD) $(RACE_FLAG) -ldflags '$(LDFLAGS) $(CHECK_FLAG)' -o '$(TARGET)' tidb-server/main.go
endif

server_check: parserlib
ifeq ($(TARGET), "")
$(GOBUILD) $(RACE_FLAG) -ldflags '$(CHECK_LDFLAGS)' -o bin/tidb-server tidb-server/main.go
else
$(GOBUILD) $(RACE_FLAG) -ldflags '$(LDFLAGS)' -o '$(TARGET)' tidb-server/main.go
$(GOBUILD) $(RACE_FLAG) -ldflags '$(CHECK_LDFLAGS)' -o '$(TARGET)' tidb-server/main.go
endif

benchkv:
Expand Down
1 change: 1 addition & 0 deletions ast/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ const (
FlushNone FlushStmtType = iota
FlushTables
FlushPrivileges
FlushStatus
)

// FlushStmt is a statement to flush tables/privileges/optimizer costs and so on.
Expand Down
39 changes: 20 additions & 19 deletions cmd/explaintest/r/explain_easy.result
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ set @@session.tidb_opt_insubquery_unfold = 1;
set @@session.tidb_opt_agg_push_down = 1;
explain select * from t3 where exists (select s.a from t3 s having sum(s.a) = t3.a );
id count task operator info
Projection_13 8000.00 root test.t3.a, test.t3.b, test.t3.c, test.t3.d
└─HashLeftJoin_14 8000.00 root semi join, inner:StreamAgg_30, equal:[eq(cast(test.t3.a), sel_agg_1)]
├─Projection_15 10000.00 root test.t3.a, test.t3.b, test.t3.c, test.t3.d, cast(test.t3.a)
│ └─TableReader_17 10000.00 root data:TableScan_16
│ └─TableScan_16 10000.00 cop table:t3, range:[-inf,+inf], keep order:false, stats:pseudo
└─StreamAgg_30 1.00 root funcs:sum(col_0)
└─TableReader_31 1.00 root data:StreamAgg_22
└─StreamAgg_22 1.00 cop funcs:sum(s.a)
└─TableScan_29 10000.00 cop table:s, range:[-inf,+inf], keep order:false, stats:pseudo
Projection_12 8000.00 root test.t3.a, test.t3.b, test.t3.c, test.t3.d
└─HashLeftJoin_13 8000.00 root semi join, inner:StreamAgg_29, equal:[eq(cast(test.t3.a), sel_agg_1)]
├─Projection_14 10000.00 root test.t3.a, test.t3.b, test.t3.c, test.t3.d, cast(test.t3.a)
│ └─TableReader_16 10000.00 root data:TableScan_15
│ └─TableScan_15 10000.00 cop table:t3, range:[-inf,+inf], keep order:false, stats:pseudo
└─StreamAgg_29 1.00 root funcs:sum(col_0)
└─TableReader_30 1.00 root data:StreamAgg_21
└─StreamAgg_21 1.00 cop funcs:sum(s.a)
└─TableScan_28 10000.00 cop table:s, range:[-inf,+inf], keep order:false, stats:pseudo
explain select * from t1;
id count task operator info
TableReader_5 10000.00 root data:TableScan_4
Expand Down Expand Up @@ -112,13 +112,14 @@ MemTableScan_4 10000.00 root
explain select c2 = (select c2 from t2 where t1.c1 = t2.c1 order by c1 limit 1) from t1;
id count task operator info
Projection_12 10000.00 root eq(test.t1.c2, test.t2.c2)
└─Apply_14 10000.00 root left outer join, inner:Limit_22
└─Apply_14 10000.00 root left outer join, inner:Limit_21
├─TableReader_16 10000.00 root data:TableScan_15
│ └─TableScan_15 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo
└─Limit_22 1.00 root offset:0, count:1
└─IndexLookUp_47 0.00 root
├─IndexScan_45 0.00 cop table:t2, index:c1, range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true, stats:pseudo
└─TableScan_46 0.00 cop table:t2, keep order:false, stats:pseudo
└─Limit_21 1.00 root offset:0, count:1
└─IndexLookUp_43 1.00 root
├─Limit_42 1.00 cop offset:0, count:1
│ └─IndexScan_40 1.25 cop table:t2, index:c1, range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true, stats:pseudo
└─TableScan_41 1.00 cop table:t2, keep order:false
explain select * from t1 order by c1 desc limit 1;
id count task operator info
Limit_10 1.00 root offset:0, count:1
Expand Down Expand Up @@ -286,8 +287,8 @@ Projection_11 10000.00 root 9_aux_0
│ └─TableScan_14 10000.00 cop table:t, range:[-inf,+inf], keep order:false, stats:pseudo
└─StreamAgg_20 1.00 root funcs:count(1)
└─IndexJoin_32 10000.00 root inner join, inner:TableReader_31, outer key:s.a, inner key:t1.a
├─IndexReader_36 10.00 root index:IndexScan_35
│ └─IndexScan_35 10.00 cop table:s, index:b, range: decided by [eq(s.b, test.t.a)], keep order:false, stats:pseudo
├─IndexReader_36 10000.00 root index:IndexScan_35
│ └─IndexScan_35 10000.00 cop table:s, index:b, range: decided by [eq(s.b, test.t.a)], keep order:false, stats:pseudo
└─TableReader_31 10.00 root data:TableScan_30
└─TableScan_30 10.00 cop table:t1, range: decided by [s.a], keep order:false, stats:pseudo
explain select t.c in (select count(*) from t s use index(idx), t t1 where s.b = t.a and s.c = t1.a) from t;
Expand All @@ -298,9 +299,9 @@ Projection_11 10000.00 root 9_aux_0
│ └─TableScan_14 10000.00 cop table:t, range:[-inf,+inf], keep order:false, stats:pseudo
└─StreamAgg_20 1.00 root funcs:count(1)
└─IndexJoin_33 10000.00 root inner join, inner:TableReader_32, outer key:s.c, inner key:t1.a
├─IndexLookUp_38 10.00 root
│ ├─IndexScan_36 10.00 cop table:s, index:b, range: decided by [eq(s.b, test.t.a)], keep order:false, stats:pseudo
│ └─TableScan_37 10.00 cop table:t, keep order:false, stats:pseudo
├─IndexLookUp_38 10000.00 root
│ ├─IndexScan_36 10000.00 cop table:s, index:b, range: decided by [eq(s.b, test.t.a)], keep order:false, stats:pseudo
│ └─TableScan_37 10000.00 cop table:t, keep order:false, stats:pseudo
└─TableReader_32 10.00 root data:TableScan_31
└─TableScan_31 10.00 cop table:t1, range: decided by [s.c], keep order:false, stats:pseudo
drop table if exists t;
Expand Down
29 changes: 15 additions & 14 deletions cmd/explaintest/r/explain_easy_stats.result
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ set @@session.tidb_opt_insubquery_unfold = 1;
set @@session.tidb_opt_agg_push_down = 1;
explain select * from t3 where exists (select s.a from t3 s having sum(s.a) = t3.a );
id count task operator info
Projection_13 1600.00 root test.t3.a, test.t3.b, test.t3.c, test.t3.d
└─HashLeftJoin_14 1600.00 root semi join, inner:StreamAgg_30, equal:[eq(cast(test.t3.a), sel_agg_1)]
├─Projection_15 2000.00 root test.t3.a, test.t3.b, test.t3.c, test.t3.d, cast(test.t3.a)
│ └─TableReader_17 2000.00 root data:TableScan_16
│ └─TableScan_16 2000.00 cop table:t3, range:[-inf,+inf], keep order:false
└─StreamAgg_30 1.00 root funcs:sum(col_0)
└─TableReader_31 1.00 root data:StreamAgg_22
└─StreamAgg_22 1.00 cop funcs:sum(s.a)
└─TableScan_29 2000.00 cop table:s, range:[-inf,+inf], keep order:false
Projection_12 1600.00 root test.t3.a, test.t3.b, test.t3.c, test.t3.d
└─HashLeftJoin_13 1600.00 root semi join, inner:StreamAgg_29, equal:[eq(cast(test.t3.a), sel_agg_1)]
├─Projection_14 2000.00 root test.t3.a, test.t3.b, test.t3.c, test.t3.d, cast(test.t3.a)
│ └─TableReader_16 2000.00 root data:TableScan_15
│ └─TableScan_15 2000.00 cop table:t3, range:[-inf,+inf], keep order:false
└─StreamAgg_29 1.00 root funcs:sum(col_0)
└─TableReader_30 1.00 root data:StreamAgg_21
└─StreamAgg_21 1.00 cop funcs:sum(s.a)
└─TableScan_28 2000.00 cop table:s, range:[-inf,+inf], keep order:false
explain select * from t1;
id count task operator info
TableReader_5 1999.00 root data:TableScan_4
Expand Down Expand Up @@ -101,13 +101,14 @@ MemTableScan_4 10000.00 root
explain select c2 = (select c2 from t2 where t1.c1 = t2.c1 order by c1 limit 1) from t1;
id count task operator info
Projection_12 1999.00 root eq(test.t1.c2, test.t2.c2)
└─Apply_14 1999.00 root left outer join, inner:Limit_22
└─Apply_14 1999.00 root left outer join, inner:Limit_21
├─TableReader_16 1999.00 root data:TableScan_15
│ └─TableScan_15 1999.00 cop table:t1, range:[-inf,+inf], keep order:false
└─Limit_22 1.00 root offset:0, count:1
└─IndexLookUp_47 0.00 root
├─IndexScan_45 0.00 cop table:t2, index:c1, range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true
└─TableScan_46 0.00 cop table:t2, keep order:false
└─Limit_21 1.00 root offset:0, count:1
└─IndexLookUp_43 1.00 root
├─Limit_42 1.00 cop offset:0, count:1
│ └─IndexScan_40 1.25 cop table:t2, index:c1, range: decided by [eq(test.t1.c1, test.t2.c1)], keep order:true
└─TableScan_41 1.00 cop table:t2, keep order:false
explain select * from t1 order by c1 desc limit 1;
id count task operator info
Limit_10 1.00 root offset:0, count:1
Expand Down
Loading

0 comments on commit 619da40

Please sign in to comment.