Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pingcap/tidb into nth
Browse files Browse the repository at this point in the history
  • Loading branch information
alivxxx committed Mar 11, 2019
2 parents 1f96691 + f0aca29 commit d63212e
Show file tree
Hide file tree
Showing 87 changed files with 1,732 additions and 466 deletions.
45 changes: 45 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
codecov:
notify:
require_ci_to_pass: yes

coverage:
precision: 4
round: down
range: "65...90"

status:
project:
default:
threshold: 0.2 #Allow the coverage to drop by threshold%, and posting a success status.
patch:
default:
target: 0% # trial operation
changes: no

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "header, diff"
behavior: default
require_changes: no

ignore:
- "LICENSES"
- "*_test.go"
- ".git"
- "*.yml"
- "*.md"
- "cmd/.*"
- "docs/.*"
- "vendor/.*"
- "ddl/failtest/.*"
- "ddl/testutil/.*"
- "executor/seqtest/.*"
- "metrics/.*"

4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: go
go_import_path: github.com/pingcap/tidb

go:
- "1.11.3"
- "1.12"

env:
- TRAVIS_COVERAGE=0
Expand All @@ -13,7 +13,7 @@ env:
matrix:
fast_finish: true
allow_failures:
- go: "1.11.3"
- go: "1.12"
env: TRAVIS_COVERAGE=1

before_install:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Builder image
FROM golang:1.11.5-alpine as builder
FROM golang:1.12-alpine as builder

RUN apk add --no-cache \
wget \
Expand Down
29 changes: 19 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif
FAIL_ON_STDOUT := awk '{ print } END { if (NR > 0) { exit 1 } }'

CURDIR := $(shell pwd)
path_to_add := $(addsuffix /bin,$(subst :,/bin:,$(GOPATH)))
path_to_add := $(addsuffix /bin,$(subst :,/bin:,$(GOPATH))):$(PWD)/tools/bin
export PATH := $(path_to_add):$(PATH)

GO := GO111MODULE=on go
Expand All @@ -27,7 +27,7 @@ FILES := $$(find $$($(PACKAGE_DIRECTORIES)) -name "*.go")
GOFAIL_ENABLE := $$(find $$PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/gofail enable)
GOFAIL_DISABLE := $$(find $$PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/gofail disable)

LDFLAGS += -X "github.com/pingcap/parser/mysql.TiDBReleaseVersion=$(shell git describe --tags --dirty)"
LDFLAGS += -X "github.com/pingcap/parser/mysql.TiDBReleaseVersion=$(shell git describe --tags --dirty --always)"
LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBBuildTS=$(shell date -u '+%Y-%m-%d %I:%M:%S')"
LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBGitHash=$(shell git rev-parse HEAD)"
LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBGitBranch=$(shell git rev-parse --abbrev-ref HEAD)"
Expand All @@ -53,18 +53,18 @@ all: dev server benchkv
parser:
@echo "remove this command later, when our CI script doesn't call it"

dev: checklist test check
dev: checklist check test

build:
$(GOBUILD)

# Install the check tools.
check-setup:tools/bin/megacheck tools/bin/revive tools/bin/goword tools/bin/gometalinter tools/bin/gosec
check-setup:tools/bin/revive tools/bin/goword tools/bin/gometalinter tools/bin/gosec

check: fmt errcheck lint tidy
check: fmt errcheck lint tidy check-static

# These need to be fixed before they can be ran regularly
check-fail: goword check-static check-slow
check-fail: goword check-slow

fmt:
@echo "gofmt (simplify)"
Expand All @@ -76,11 +76,12 @@ goword:tools/bin/goword
gosec:tools/bin/gosec
tools/bin/gosec $$($(PACKAGE_DIRECTORIES))

check-static:tools/bin/gometalinter
@ # vet and fmt have problems with vendor when ran through metalinter
check-static:tools/bin/gometalinter tools/bin/misspell tools/bin/ineffassign
@ # TODO: enable megacheck.
@ # TODO: gometalinter has been DEPRECATED.
@ # https://github.com/alecthomas/gometalinter/issues/590
tools/bin/gometalinter --disable-all --deadline 120s \
--enable misspell \
--enable megacheck \
--enable ineffassign \
$$($(PACKAGE_DIRECTORIES))

Expand Down Expand Up @@ -127,7 +128,8 @@ ifeq ("$(TRAVIS_COVERAGE)", "1")
@echo "Running in TRAVIS_COVERAGE mode."
@export log_level=error; \
$(GO) get github.com/go-playground/overalls
$(OVERALLS) -project=github.com/pingcap/tidb -covermode=count -ignore='.git,vendor,cmd,docs,LICENSES' -concurrency=1 || { $(GOFAIL_DISABLE); exit 1; }
$(OVERALLS) -project=github.com/pingcap/tidb -covermode=count -ignore='.git,vendor,cmd,docs,LICENSES,ddl/failtest,ddl/testutil/,executor/esqtest' \
-concurrency=1 || { $(GOFAIL_DISABLE); exit 1; }
else
@echo "Running in native mode."
@export log_level=error; \
Expand Down Expand Up @@ -226,3 +228,10 @@ tools/bin/errcheck: tools/check/go.mod

tools/bin/gofail: go.mod
$(GO) build -o $@ github.com/pingcap/gofail

tools/bin/misspell:tools/check/go.mod
$(GO) get -u github.com/client9/misspell/cmd/misspell

tools/bin/ineffassign:tools/check/go.mod
cd tools/check; \
$(GO) build -o ../bin/ineffassign github.com/gordonklaus/ineffassign
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
build:
docker:
- image: golang:1.11.3
- image: golang:1.12
working_directory: /go/src/github.com/pingcap/tidb
steps:
- checkout
Expand Down
46 changes: 23 additions & 23 deletions cmd/explaintest/r/explain_easy.result
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ TableReader_7 0.33 root data:Selection_6
explain select sum(t1.c1 in (select c1 from t2)) from t1;
id count task operator info
StreamAgg_12 1.00 root funcs:sum(col_0)
└─Projection_21 10000.00 root cast(5_aux_0)
└─Projection_19 10000.00 root cast(5_aux_0)
└─HashLeftJoin_18 10000.00 root left outer semi join, inner:TableReader_17, other cond:eq(test.t1.c1, test.t2.c1)
├─TableReader_20 10000.00 root data:TableScan_19
│ └─TableScan_19 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15 10000.00 root data:TableScan_14
│ └─TableScan_14 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_17 10000.00 root data:TableScan_16
└─TableScan_16 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select c1 from t1 where c1 in (select c2 from t2);
Expand Down Expand Up @@ -196,10 +196,10 @@ set @@session.tidb_opt_insubq_to_join_and_agg=0;
explain select sum(t1.c1 in (select c1 from t2)) from t1;
id count task operator info
StreamAgg_12 1.00 root funcs:sum(col_0)
└─Projection_21 10000.00 root cast(5_aux_0)
└─Projection_19 10000.00 root cast(5_aux_0)
└─HashLeftJoin_18 10000.00 root left outer semi join, inner:TableReader_17, other cond:eq(test.t1.c1, test.t2.c1)
├─TableReader_20 10000.00 root data:TableScan_19
│ └─TableScan_19 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15 10000.00 root data:TableScan_14
│ └─TableScan_14 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_17 10000.00 root data:TableScan_16
└─TableScan_16 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select 1 in (select c2 from t2) from t1;
Expand All @@ -214,10 +214,10 @@ Projection_6 10000.00 root 5_aux_0
explain select sum(6 in (select c2 from t2)) from t1;
id count task operator info
StreamAgg_12 1.00 root funcs:sum(col_0)
└─Projection_22 10000.00 root cast(5_aux_0)
└─Projection_20 10000.00 root cast(5_aux_0)
└─HashLeftJoin_19 10000.00 root left outer semi join, inner:TableReader_18
├─TableReader_21 10000.00 root data:TableScan_20
│ └─TableScan_20 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo
├─TableReader_15 10000.00 root data:TableScan_14
│ └─TableScan_14 10000.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_18 10.00 root data:Selection_17
└─Selection_17 10.00 cop eq(6, test.t2.c2)
└─TableScan_16 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo
Expand All @@ -229,24 +229,24 @@ subgraph cluster12{
node [style=filled, color=lightgrey]
color=black
label = "root"
"StreamAgg_12" -> "Projection_21"
"Projection_21" -> "HashLeftJoin_18"
"HashLeftJoin_18" -> "TableReader_20"
"StreamAgg_12" -> "Projection_19"
"Projection_19" -> "HashLeftJoin_18"
"HashLeftJoin_18" -> "TableReader_15"
"HashLeftJoin_18" -> "TableReader_17"
}
subgraph cluster19{
subgraph cluster14{
node [style=filled, color=lightgrey]
color=black
label = "cop"
"TableScan_19"
"TableScan_14"
}
subgraph cluster16{
node [style=filled, color=lightgrey]
color=black
label = "cop"
"TableScan_16"
}
"TableReader_20" -> "TableScan_19"
"TableReader_15" -> "TableScan_14"
"TableReader_17" -> "TableScan_16"
}

Expand Down Expand Up @@ -289,8 +289,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_44 12.50 root inner join, inner:TableReader_43, outer key:s.a, inner key:t1.a
├─TableReader_52 1.00 root data:TableScan_51
│ └─TableScan_51 1.00 cop table:s, range: decided by [eq(s.a, test.t.a)], keep order:false, stats:pseudo
├─TableReader_37 1.00 root data:TableScan_36
│ └─TableScan_36 1.00 cop table:s, range: decided by [eq(s.a, test.t.a)], keep order:false, stats:pseudo
└─TableReader_43 10.00 root data:Selection_42
└─Selection_42 10.00 cop eq(t1.a, test.t.a)
└─TableScan_41 10.00 cop table:t1, range: decided by [s.a], keep order:false, stats:pseudo
Expand All @@ -302,8 +302,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 12.50 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_27 10.00 root index:IndexScan_26
│ └─IndexScan_26 10.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 @@ -314,10 +314,10 @@ 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_34 12.49 root inner join, inner:TableReader_33, outer key:s.c, inner key:t1.a
├─IndexLookUp_40 9.99 root
│ ├─IndexScan_37 10.00 cop table:s, index:b, range: decided by [eq(s.b, test.t.a)], keep order:false, stats:pseudo
│ └─Selection_39 9.99 cop not(isnull(s.c))
│ └─TableScan_38 10.00 cop table:t, keep order:false, stats:pseudo
├─IndexLookUp_29 9.99 root
│ ├─IndexScan_26 10.00 cop table:s, index:b, range: decided by [eq(s.b, test.t.a)], keep order:false, stats:pseudo
│ └─Selection_28 9.99 cop not(isnull(s.c))
│ └─TableScan_27 10.00 cop table:t, keep order:false, stats:pseudo
└─TableReader_33 10.00 root data:TableScan_32
└─TableScan_32 10.00 cop table:t1, range: decided by [s.c], keep order:false, stats:pseudo
drop table if exists t;
Expand Down
27 changes: 27 additions & 0 deletions cmd/explaintest/r/index_join.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
drop table if exists t1, t2;
create table t1(a bigint, b bigint, index idx(a));
create table t2(a bigint, b bigint, index idx(a));
insert into t1 values(1, 1), (1, 1), (1, 1), (1, 1), (1, 1);
insert into t2 values(1, 1);
analyze table t1, t2;
explain select /*+ TIDB_INLJ(t1, t2) */ * from t1 join t2 on t1.a=t2.a;
id count task operator info
IndexJoin_16 5.00 root inner join, inner:IndexLookUp_15, outer key:test.t2.a, inner key:test.t1.a
├─IndexLookUp_15 0.00 root
│ ├─Selection_14 0.00 cop not(isnull(test.t1.a))
│ │ └─IndexScan_12 5.00 cop table:t1, index:a, range: decided by [test.t2.a], keep order:false
│ └─TableScan_13 0.00 cop table:t1, keep order:false
└─TableReader_19 1.00 root data:Selection_18
└─Selection_18 1.00 cop not(isnull(test.t2.a))
└─TableScan_17 1.00 cop table:t2, range:[-inf,+inf], keep order:false
explain select * from t1 join t2 on t1.a=t2.a;
id count task operator info
Projection_6 5.00 root test.t1.a, test.t1.b, test.t2.a, test.t2.b
└─IndexJoin_12 5.00 root inner join, inner:IndexLookUp_11, outer key:test.t2.a, inner key:test.t1.a
├─TableReader_32 1.00 root data:Selection_31
│ └─Selection_31 1.00 cop not(isnull(test.t2.a))
│ └─TableScan_30 1.00 cop table:t2, range:[-inf,+inf], keep order:false
└─IndexLookUp_11 0.00 root
├─Selection_10 0.00 cop not(isnull(test.t1.a))
│ └─IndexScan_8 5.00 cop table:t1, index:a, range: decided by [test.t2.a], keep order:false
└─TableScan_9 0.00 cop table:t1, keep order:false
53 changes: 53 additions & 0 deletions cmd/explaintest/r/topn_push_down.result
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,56 @@ Apply_17 9990.00 root semi join, inner:Selection_21, equal:[eq(test.t1.a, x.a)]
└─Limit_28 1.00 cop offset:0, count:1
└─Selection_27 1.00 cop gt(test.t2.b, test.t1.b)
└─TableScan_26 1.25 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo
drop table if exists t;
create table t(a int not null, index idx(a));
explain select /*+ TIDB_INLJ(t2) */ * from t t1 join t t2 on t1.a = t2.a limit 5;
id count task operator info
Limit_11 5.00 root offset:0, count:5
└─IndexJoin_15 5.00 root inner join, inner:IndexReader_14, outer key:t1.a, inner key:t2.a
├─TableReader_17 4.00 root data:TableScan_16
│ └─TableScan_16 4.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo
└─IndexReader_14 10.00 root index:IndexScan_13
└─IndexScan_13 10.00 cop table:t2, index:a, range: decided by [t1.a], keep order:false, stats:pseudo
explain select /*+ TIDB_INLJ(t2) */ * from t t1 left join t t2 on t1.a = t2.a where t2.a is null limit 5;
id count task operator info
Limit_12 5.00 root offset:0, count:5
└─Selection_13 5.00 root isnull(t2.a)
└─IndexJoin_17 5.00 root left outer join, inner:IndexReader_16, outer key:t1.a, inner key:t2.a
├─TableReader_19 4.00 root data:TableScan_18
│ └─TableScan_18 4.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo
└─IndexReader_16 10.00 root index:IndexScan_15
└─IndexScan_15 10.00 cop table:t2, index:a, range: decided by [t1.a], keep order:false, stats:pseudo
explain select /*+ TIDB_SMJ(t1, t2) */ * from t t1 join t t2 on t1.a = t2.a limit 5;
id count task operator info
Limit_11 5.00 root offset:0, count:5
└─MergeJoin_12 5.00 root inner join, left key:t1.a, right key:t2.a
├─IndexReader_14 4.00 root index:IndexScan_13
│ └─IndexScan_13 4.00 cop table:t1, index:a, range:[NULL,+inf], keep order:true, stats:pseudo
└─IndexReader_16 4.00 root index:IndexScan_15
└─IndexScan_15 4.00 cop table:t2, index:a, range:[NULL,+inf], keep order:true, stats:pseudo
explain select /*+ TIDB_SMJ(t1, t2) */ * from t t1 left join t t2 on t1.a = t2.a where t2.a is null limit 5;
id count task operator info
Limit_12 5.00 root offset:0, count:5
└─Selection_13 5.00 root isnull(t2.a)
└─MergeJoin_14 5.00 root left outer join, left key:t1.a, right key:t2.a
├─IndexReader_16 4.00 root index:IndexScan_15
│ └─IndexScan_15 4.00 cop table:t1, index:a, range:[NULL,+inf], keep order:true, stats:pseudo
└─IndexReader_18 4.00 root index:IndexScan_17
└─IndexScan_17 4.00 cop table:t2, index:a, range:[NULL,+inf], keep order:true, stats:pseudo
explain select /*+ TIDB_HJ(t1, t2) */ * from t t1 join t t2 on t1.a = t2.a limit 5;
id count task operator info
Limit_11 5.00 root offset:0, count:5
└─HashLeftJoin_19 5.00 root inner join, inner:TableReader_24, equal:[eq(t1.a, t2.a)]
├─TableReader_22 4.00 root data:TableScan_21
│ └─TableScan_21 4.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_24 10000.00 root data:TableScan_23
└─TableScan_23 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo
explain select /*+ TIDB_HJ(t1, t2) */ * from t t1 left join t t2 on t1.a = t2.a where t2.a is null limit 5;
id count task operator info
Limit_12 5.00 root offset:0, count:5
└─Selection_13 5.00 root isnull(t2.a)
└─HashLeftJoin_18 5.00 root left outer join, inner:TableReader_22, equal:[eq(t1.a, t2.a)]
├─TableReader_20 4.00 root data:TableScan_19
│ └─TableScan_19 4.00 cop table:t1, range:[-inf,+inf], keep order:false, stats:pseudo
└─TableReader_22 10000.00 root data:TableScan_21
└─TableScan_21 10000.00 cop table:t2, range:[-inf,+inf], keep order:false, stats:pseudo
Loading

0 comments on commit d63212e

Please sign in to comment.