Skip to content

Commit

Permalink
Merge branch 'master' into pitr-retart-task
Browse files Browse the repository at this point in the history
  • Loading branch information
joccau authored Oct 27, 2022
2 parents a149c11 + ec93697 commit 05f9ad3
Show file tree
Hide file tree
Showing 439 changed files with 25,795 additions and 15,145 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
startup --host_jvm_args=-Xmx6g
startup --host_jvm_args=-Xmx5g
startup --unlimit_coredumps

run:ci --color=yes
Expand Down
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.git/
bazel-bin/
bazel-out/
bazel-tidb/
bazel-testlogs/
bin/
tidb-server/tidb-server
*.test.bin
cmd/
Dockerfile
1 change: 1 addition & 0 deletions .github/licenserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ header:
- "docs/"
- "br/"
- ".gitignore"
- ".dockerignore"
- ".gitattributes"
- ".cilinter.yaml"
- ".golangci.yml"
Expand Down
47 changes: 31 additions & 16 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ def go_deps():
sum = "h1:zeZSRqj5yCg28tCkIV/z/lWbwvNm5qnKVS15PI8nhD0=",
version = "v0.1.0",
)
go_repository(
name = "com_github_acarl005_stripansi",
build_file_proto_mode = "disable",
importpath = "github.com/acarl005/stripansi",
sum = "h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=",
version = "v0.0.0-20180116102854-5a71ef0e047d",
)

go_repository(
name = "com_github_ajg_form",
Expand Down Expand Up @@ -2790,8 +2797,8 @@ def go_deps():
name = "com_github_pingcap_errors",
build_file_proto_mode = "disable_global",
importpath = "github.com/pingcap/errors",
sum = "h1:xpW9bvK+HuuTmyFqUwr+jcCvpVkK7sumiz+ko5H9eq4=",
version = "v0.11.5-0.20211224045212-9687c2b0f87c",
sum = "h1:3Dm0DWeQlwV8LbpQxP2tojHhxd9aY59KI+QN0ns6bBo=",
version = "v0.11.5-0.20220729040631-518f63d66278",
)
go_repository(
name = "com_github_pingcap_failpoint",
Expand All @@ -2818,8 +2825,8 @@ def go_deps():
name = "com_github_pingcap_kvproto",
build_file_proto_mode = "disable_global",
importpath = "github.com/pingcap/kvproto",
sum = "h1:/92S0s/TCoCmK2vv6WbkXNeqtLn90sHRJ5Vlx1Sigas=",
version = "v0.0.0-20220913025519-586cff113d10",
sum = "h1:McYxPhA8SHqfUtLfQHHN0fQl4dy93IkhlX4Pp2MKIFA=",
version = "v0.0.0-20221014081430-26e28e6a281a",
)
go_repository(
name = "com_github_pingcap_log",
Expand All @@ -2839,8 +2846,8 @@ def go_deps():
name = "com_github_pingcap_tipb",
build_file_proto_mode = "disable_global",
importpath = "github.com/pingcap/tipb",
sum = "h1:kWYridgsn8xSKYJ2EkXp7uj5HwJnG5snpY3XP8oYmPU=",
version = "v0.0.0-20220824081009-0714a57aff1d",
sum = "h1:Yoo8j5xQGxjlsC3yt0ndsiAz0WZXED9rzsKmEN0U0DY=",
version = "v0.0.0-20221020071514-cd933387bcb5",
)
go_repository(
name = "com_github_pkg_browser",
Expand Down Expand Up @@ -3205,8 +3212,8 @@ def go_deps():
name = "com_github_shurcool_vfsgen",
build_file_proto_mode = "disable_global",
importpath = "github.com/shurcooL/vfsgen",
sum = "h1:y0cMJ0qjii33BnD6tMGcF/+gHYsoKQ6tbwQpy233OII=",
version = "v0.0.0-20180711163814-62bca832be04",
sum = "h1:ug7PpSOB5RBPK1Kg6qskGBoP3Vnj/aNYFTznWvlkGo0=",
version = "v0.0.0-20181202132449-6a9ea43bcacd",
)
go_repository(
name = "com_github_sirupsen_logrus",
Expand Down Expand Up @@ -3422,15 +3429,15 @@ def go_deps():
name = "com_github_tikv_client_go_v2",
build_file_proto_mode = "disable_global",
importpath = "github.com/tikv/client-go/v2",
sum = "h1:TxDSQAmtGdE34BvOaYF35mRrAXePeZEq8quvuAwrKsI=",
version = "v2.0.1-0.20220923061703-33efe476e022",
sum = "h1:5KLqhDGLc/mtemdS/odfOP717rn8ttsTj3jzZ8TZn9A=",
version = "v2.0.1-0.20221017092635-91be9c6ce6c0",
)
go_repository(
name = "com_github_tikv_pd_client",
build_file_proto_mode = "disable_global",
importpath = "github.com/tikv/pd/client",
sum = "h1:r1eMh9Rny3hfWuBuxOnbsCRrR4FhthiNxLQ5rAUtaww=",
version = "v0.0.0-20220725055910-7187a7ab72db",
sum = "h1:REQOR1XraH1fT9BCoNBPZs1CAe+w7VPLU+d+si7DLYo=",
version = "v0.0.0-20221010134149-d50e5fe43f14",
)
go_repository(
name = "com_github_timakin_bodyclose",
Expand Down Expand Up @@ -3584,12 +3591,20 @@ def go_deps():
sum = "h1:0R4NLDRDZX6JcmhJgXi5E4b8Wg84ihbmUKp/GvSPEzc=",
version = "v0.0.0-20161114210144-ceec8f93295a",
)
go_repository(
name = "com_github_vbauerster_mpb_v7",
build_file_proto_mode = "disable",
importpath = "github.com/vbauerster/mpb/v7",
sum = "h1:BkGfmb6nMrrBQDFECR/Q7RkKCw7ylMetCb4079CGs4w=",
version = "v7.5.3",
)

go_repository(
name = "com_github_vividcortex_ewma",
build_file_proto_mode = "disable_global",
importpath = "github.com/VividCortex/ewma",
sum = "h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM=",
version = "v1.1.1",
sum = "h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=",
version = "v1.2.0",
)
go_repository(
name = "com_github_wangjohn_quickselect",
Expand Down Expand Up @@ -4250,8 +4265,8 @@ def go_deps():
name = "org_golang_x_crypto",
build_file_proto_mode = "disable_global",
importpath = "golang.org/x/crypto",
sum = "h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=",
version = "v0.0.0-20210921155107-089bfa567519",
sum = "h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=",
version = "v0.0.0-20220411220226-7b82a4e95df4",
)
go_repository(
name = "org_golang_x_exp",
Expand Down
46 changes: 10 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2019 PingCAP, Inc.
# Copyright 2022 PingCAP, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,45 +13,19 @@
# limitations under the License.

# Builder image
FROM golang:1.19.1-alpine as builder
FROM alpine:edge as builder

RUN apk add --no-cache \
wget \
make \
git \
gcc \
binutils-gold \
musl-dev
ADD . https://raw.githubusercontent.com/njhallett/apk-fastest-mirror/c4ca44caef3385d830fea34df2dbc2ba4a17e021/apk-fastest-mirror.sh ./proxy
RUN sh ./proxy/apk-fastest-mirror.sh -t 50 && apk add --no-cache git build-base go

RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64 \
&& chmod +x /usr/local/bin/dumb-init
COPY . /tidb
ARG GOPROXY
RUN export GOPROXY=${GOPROXY} && cd /tidb && make server

RUN mkdir -p /go/src/github.com/pingcap/tidb
WORKDIR /go/src/github.com/pingcap/tidb
FROM alpine:latest

# Cache dependencies
COPY go.mod .
COPY go.sum .
COPY parser/go.mod parser/go.mod
COPY parser/go.sum parser/go.sum

RUN GO111MODULE=on go mod download

# Build real binaries
COPY . .
RUN make

# Executable image
FROM alpine

RUN apk add --no-cache \
curl

COPY --from=builder /go/src/github.com/pingcap/tidb/bin/tidb-server /tidb-server
COPY --from=builder /usr/local/bin/dumb-init /usr/local/bin/dumb-init
COPY --from=builder /tidb/bin/tidb-server /tidb-server

WORKDIR /

EXPOSE 4000

ENTRYPOINT ["/usr/local/bin/dumb-init", "/tidb-server"]
ENTRYPOINT ["/tidb-server"]
22 changes: 14 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,30 +140,30 @@ race: failpoint-enable

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

server_debug:
ifeq ($(TARGET), "")
CGO_ENABLED=1 $(GOBUILD) -gcflags="all=-N -l" $(RACE_FLAG) -ldflags '$(LDFLAGS) $(CHECK_FLAG)' -o bin/tidb-server-debug tidb-server/main.go
CGO_ENABLED=1 $(GOBUILD) -gcflags="all=-N -l" $(RACE_FLAG) -ldflags '$(LDFLAGS) $(CHECK_FLAG)' -o bin/tidb-server-debug ./tidb-server
else
CGO_ENABLED=1 $(GOBUILD) -gcflags="all=-N -l" $(RACE_FLAG) -ldflags '$(LDFLAGS) $(CHECK_FLAG)' -o '$(TARGET)' tidb-server/main.go
CGO_ENABLED=1 $(GOBUILD) -gcflags="all=-N -l" $(RACE_FLAG) -ldflags '$(LDFLAGS) $(CHECK_FLAG)' -o '$(TARGET)' ./tidb-server
endif

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

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

server_coverage:
Expand Down Expand Up @@ -461,3 +461,9 @@ bazel_addindextest: failpoint-enable bazel_ci_prepare

bazel_lint: bazel_prepare
bazel build //... --//build:with_nogo_flag=true

docker:
docker build -t "$(DOCKERPREFIX)tidb:latest" --build-arg 'GOPROXY=$(shell go env GOPROXY),' -f Dockerfile .

docker-test:
docker buildx build --platform linux/amd64,linux/arm64 --push -t "$(DOCKERPREFIX)tidb:latest" --build-arg 'GOPROXY=$(shell go env GOPROXY),' -f Dockerfile .
4 changes: 2 additions & 2 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ DUMPLING_GOTEST := CGO_ENABLED=1 GO111MODULE=on go test -ldflags '$(DUMPLING_LD
TEST_COVERAGE_DIR := "test_coverage"

ifneq ("$(CI)", "0")
BAZEL_GLOBAL_CONFIG := --output_user_root=/home/jenkins/.tidb/tmp
BAZEL_CMD_CONFIG := --config=ci
BAZEL_GLOBAL_CONFIG := --output_user_root=/home/jenkins/.tidb/tmp --host_jvm_args=-XX:+UnlockExperimentalVMOptions --host_jvm_args=-XX:+UseZGC
BAZEL_CMD_CONFIG := --config=ci --repository_cache=/home/jenkins/.tidb/tmp
endif
1 change: 1 addition & 0 deletions bindinfo/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ go_test(
],
embed = [":bindinfo"],
flaky = True,
race = "on",
shard_count = 50,
deps = [
"//config",
Expand Down
8 changes: 5 additions & 3 deletions br/pkg/glue/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ go_library(
srcs = [
"console_glue.go",
"glue.go",
"progressing.go",
],
importpath = "github.com/pingcap/tidb/br/pkg/glue",
visibility = ["//visibility:public"],
deps = [
"//br/pkg/logutil",
"//br/pkg/utils",
"//ddl",
"//domain",
"//kv",
"//parser/model",
"//sessionctx",
"@com_github_fatih_color//:color",
"@com_github_pingcap_log//:log",
"@com_github_tikv_pd_client//:client",
"@com_github_vbauerster_mpb_v7//:mpb",
"@com_github_vbauerster_mpb_v7//decor",
"@org_golang_x_term//:term",
"@org_uber_go_zap//:zap",
],
)

Expand Down
Loading

0 comments on commit 05f9ad3

Please sign in to comment.