Skip to content

Commit edb722e

Browse files
committed
Merge branch 'master' into partition-table-split
2 parents 9d336c2 + 7188716 commit edb722e

File tree

103 files changed

+1672
-796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1672
-796
lines changed

.travis.yml

-25
This file was deleted.

Makefile

+22-22
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ PACKAGES := $$($(PACKAGE_LIST))
2424
PACKAGE_DIRECTORIES := $(PACKAGE_LIST) | sed 's|github.com/pingcap/$(PROJECT)/||'
2525
FILES := $$(find $$($(PACKAGE_DIRECTORIES)) -name "*.go")
2626

27-
GOFAIL_ENABLE := $$(find $$PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/gofail enable)
28-
GOFAIL_DISABLE := $$(find $$PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/gofail disable)
27+
FAILPOINT_ENABLE := $$(find $$PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl enable)
28+
FAILPOINT_DISABLE := $$(find $$PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl disable)
2929

3030
LDFLAGS += -X "github.com/pingcap/parser/mysql.TiDBReleaseVersion=$(shell git describe --tags --dirty --always)"
3131
LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBBuildTS=$(shell date -u '+%Y-%m-%d %I:%M:%S')"
@@ -123,37 +123,37 @@ ifeq ("$(TRAVIS_COVERAGE)", "1")
123123
bash <(curl -s https://codecov.io/bash)
124124
endif
125125

126-
gotest: gofail-enable
126+
gotest: failpoint-enable
127127
ifeq ("$(TRAVIS_COVERAGE)", "1")
128128
@echo "Running in TRAVIS_COVERAGE mode."
129129
@export log_level=error; \
130130
$(GO) get github.com/go-playground/overalls
131131
$(OVERALLS) -project=github.com/pingcap/tidb \
132132
-covermode=count \
133133
-ignore='.git,vendor,cmd,docs,LICENSES' \
134-
-concurrency=2 \
134+
-concurrency=4 \
135135
-- -coverpkg=./... \
136-
|| { $(GOFAIL_DISABLE); exit 1; }
136+
|| { $(FAILPOINT_DISABLE); exit 1; }
137137
else
138138
@echo "Running in native mode."
139139
@export log_level=error; \
140-
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' -cover $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; }
140+
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' -cover $(PACKAGES) || { $(FAILPOINT_DISABLE); exit 1; }
141141
endif
142-
@$(GOFAIL_DISABLE)
142+
@$(FAILPOINT_DISABLE)
143143

144-
race: gofail-enable
144+
race: failpoint-enable
145145
@export log_level=debug; \
146-
$(GOTEST) -timeout 20m -race $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; }
147-
@$(GOFAIL_DISABLE)
146+
$(GOTEST) -timeout 20m -race $(PACKAGES) || { $(FAILPOINT_DISABLE); exit 1; }
147+
@$(FAILPOINT_DISABLE)
148148

149-
leak: gofail-enable
149+
leak: failpoint-enable
150150
@export log_level=debug; \
151-
$(GOTEST) -tags leak $(PACKAGES) || { $(GOFAIL_DISABLE); exit 1; }
152-
@$(GOFAIL_DISABLE)
151+
$(GOTEST) -tags leak $(PACKAGES) || { $(FAILPOINT_DISABLE); exit 1; }
152+
@$(FAILPOINT_DISABLE)
153153

154-
tikv_integration_test: gofail-enable
155-
$(GOTEST) ./store/tikv/. -with-tikv=true || { $(GOFAIL_DISABLE); exit 1; }
156-
@$(GOFAIL_DISABLE)
154+
tikv_integration_test: failpoint-enable
155+
$(GOTEST) ./store/tikv/. -with-tikv=true || { $(FAILPOINT_DISABLE); exit 1; }
156+
@$(FAILPOINT_DISABLE)
157157

158158
RACE_FLAG =
159159
ifeq ("$(WITH_RACE)", "1")
@@ -195,13 +195,13 @@ importer:
195195
checklist:
196196
cat checklist.md
197197

198-
gofail-enable: tools/bin/gofail
198+
failpoint-enable: tools/bin/failpoint-ctl
199199
# Converting gofail failpoints...
200-
@$(GOFAIL_ENABLE)
200+
@$(FAILPOINT_ENABLE)
201201

202-
gofail-disable: tools/bin/gofail
202+
failpoint-disable: tools/bin/failpoint-ctl
203203
# Restoring gofail failpoints...
204-
@$(GOFAIL_DISABLE)
204+
@$(FAILPOINT_DISABLE)
205205

206206
checkdep:
207207
$(GO) list -f '{{ join .Imports "\n" }}' github.com/pingcap/tidb/store/tikv | grep ^github.com/pingcap/parser$$ || exit 0; exit 1
@@ -230,8 +230,8 @@ tools/bin/errcheck: tools/check/go.mod
230230
cd tools/check; \
231231
$(GO) build -o ../bin/errcheck github.com/kisielk/errcheck
232232

233-
tools/bin/gofail: go.mod
234-
$(GO) build -o $@ github.com/pingcap/gofail
233+
tools/bin/failpoint-ctl: go.mod
234+
$(GO) build -o $@ github.com/pingcap/failpoint/failpoint-ctl
235235

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

circle.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,4 @@ jobs:
99
- checkout
1010
- run:
1111
name: "Build & Test"
12-
command: make dev
13-
- run:
14-
name: "Check go mod replace is removed"
15-
command: ./tools/check/check_parser_replace.sh
12+
command: make dev

ddl/column.go

+13-10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"time"
2121

2222
"github.com/pingcap/errors"
23+
"github.com/pingcap/failpoint"
2324
"github.com/pingcap/parser/ast"
2425
"github.com/pingcap/parser/model"
2526
"github.com/pingcap/parser/mysql"
@@ -163,10 +164,11 @@ func onAddColumn(d *ddlCtx, t *meta.Meta, job *model.Job) (ver int64, err error)
163164
return ver, nil
164165
}
165166

166-
// gofail: var errorBeforeDecodeArgs bool
167-
// if errorBeforeDecodeArgs {
168-
// return ver, errors.New("occur an error before decode args")
169-
// }
167+
failpoint.Inject("errorBeforeDecodeArgs", func(val failpoint.Value) {
168+
if val.(bool) {
169+
failpoint.Return(ver, errors.New("occur an error before decode args"))
170+
}
171+
})
170172

171173
tblInfo, columnInfo, col, pos, offset, err := checkAddColumn(t, job)
172174
if err != nil {
@@ -374,12 +376,13 @@ func (w *worker) doModifyColumn(t *meta.Meta, job *model.Job, newCol *model.Colu
374376
}
375377
}
376378

377-
// gofail: var uninitializedOffsetAndState bool
378-
// if uninitializedOffsetAndState {
379-
// if newCol.State != model.StatePublic {
380-
// return ver, errors.New("the column state is wrong")
381-
// }
382-
// }
379+
failpoint.Inject("uninitializedOffsetAndState", func(val failpoint.Value) {
380+
if val.(bool) {
381+
if newCol.State != model.StatePublic {
382+
failpoint.Return(ver, errors.New("the column state is wrong"))
383+
}
384+
}
385+
})
383386

384387
if !mysql.HasNotNullFlag(oldCol.Flag) && mysql.HasNotNullFlag(newCol.Flag) && !mysql.HasPreventNullInsertFlag(oldCol.Flag) {
385388
// Introduce the `mysql.HasPreventNullInsertFlag` flag to prevent users from inserting or updating null values.

0 commit comments

Comments
 (0)