Skip to content

Commit

Permalink
Merge branch 'add_historical_stats_test_2' of https://github.com/Yisa…
Browse files Browse the repository at this point in the history
…er/tidb into add_historical_stats_test_2
  • Loading branch information
Yisaer committed Jan 29, 2023
2 parents a6e3e65 + c0e6038 commit 38d4e36
Show file tree
Hide file tree
Showing 148 changed files with 2,438 additions and 1,235 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.3.2
6.0.0
34 changes: 0 additions & 34 deletions .github/workflows/misc.yml

This file was deleted.

106 changes: 94 additions & 12 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ def go_deps():
sum = "h1:PHhrh5ANKFWRBh7TdYmyyq2gyT2lotnvFvvFbylF81Q=",
version = "v0.1.1",
)
go_repository(
name = "com_github_apache_skywalking_eyes",
build_file_proto_mode = "disable",
importpath = "github.com/apache/skywalking-eyes",
sum = "h1:O13kdRU6FCEZevfD01mdhTgCZLLfPZIQ0GXZrLl7FpQ=",
version = "v0.4.0",
)

go_repository(
name = "com_github_apache_thrift",
Expand Down Expand Up @@ -337,6 +344,14 @@ def go_deps():
sum = "h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M=",
version = "v0.8.0",
)
go_repository(
name = "com_github_bmatcuk_doublestar_v2",
build_file_proto_mode = "disable",
importpath = "github.com/bmatcuk/doublestar/v2",
sum = "h1:6I6oUiT/sU27eE2OFcWqBhL1SwjyvQuOssxT4a1yidI=",
version = "v2.0.4",
)

go_repository(
name = "com_github_bombsimon_wsl_v3",
build_file_proto_mode = "disable",
Expand Down Expand Up @@ -1090,8 +1105,8 @@ def go_deps():
name = "com_github_frankban_quicktest",
build_file_proto_mode = "disable_global",
importpath = "github.com/frankban/quicktest",
sum = "h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY=",
version = "v1.11.3",
sum = "h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=",
version = "v1.14.3",
)
go_repository(
name = "com_github_fsnotify_fsnotify",
Expand Down Expand Up @@ -1667,12 +1682,20 @@ def go_deps():
sum = "h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=",
version = "v0.5.9",
)
go_repository(
name = "com_github_google_go_github_v33",
build_file_proto_mode = "disable",
importpath = "github.com/google/go-github/v33",
sum = "h1:qAf9yP0qc54ufQxzwv+u9H0tiVOnPJxo0lI/JXqw3ZM=",
version = "v33.0.0",
)

go_repository(
name = "com_github_google_go_querystring",
build_file_proto_mode = "disable_global",
importpath = "github.com/google/go-querystring",
sum = "h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=",
version = "v1.0.0",
sum = "h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=",
version = "v1.1.0",
)
go_repository(
name = "com_github_google_gofuzz",
Expand All @@ -1681,6 +1704,14 @@ def go_deps():
sum = "h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g=",
version = "v1.1.0",
)
go_repository(
name = "com_github_google_licensecheck",
build_file_proto_mode = "disable",
importpath = "github.com/google/licensecheck",
sum = "h1:QoxgoDkaeC4nFrtGN1jV7IPmDCHFNIVh54e5hSt6sPs=",
version = "v0.3.1",
)

go_repository(
name = "com_github_google_martian",
build_file_proto_mode = "disable_global",
Expand Down Expand Up @@ -2051,6 +2082,14 @@ def go_deps():
sum = "h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=",
version = "v1.0.0",
)
go_repository(
name = "com_github_huandu_xstrings",
build_file_proto_mode = "disable",
importpath = "github.com/huandu/xstrings",
sum = "h1:4jgBlKK6tLKFvO8u5pmYjG91cqytmDCDvGh7ECVFfFs=",
version = "v1.3.1",
)

go_repository(
name = "com_github_hydrogen18_memlistener",
build_file_proto_mode = "disable_global",
Expand All @@ -2072,6 +2111,14 @@ def go_deps():
sum = "h1:uGg2frlt3IcT7kbV6LEp5ONv4vmoO2FW4qSO+my/aoM=",
version = "v0.0.0-20210905161508-09a460cdf81d",
)
go_repository(
name = "com_github_imdario_mergo",
build_file_proto_mode = "disable",
importpath = "github.com/imdario/mergo",
sum = "h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA=",
version = "v0.3.11",
)

go_repository(
name = "com_github_imkira_go_interpol",
build_file_proto_mode = "disable_global",
Expand Down Expand Up @@ -2667,13 +2714,36 @@ def go_deps():
sum = "h1:GJY4wlzQhuBusMF1oahQCBtUV/AQ/k69IZ68vxaac2Q=",
version = "v1.1.0",
)
go_repository(
name = "com_github_masterminds_goutils",
build_file_proto_mode = "disable",
importpath = "github.com/Masterminds/goutils",
sum = "h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=",
version = "v1.1.1",
)

go_repository(
name = "com_github_masterminds_semver",
build_file_proto_mode = "disable",
importpath = "github.com/Masterminds/semver",
sum = "h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=",
version = "v1.5.0",
)
go_repository(
name = "com_github_masterminds_semver_v3",
build_file_proto_mode = "disable",
importpath = "github.com/Masterminds/semver/v3",
sum = "h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=",
version = "v3.1.1",
)
go_repository(
name = "com_github_masterminds_sprig_v3",
build_file_proto_mode = "disable",
importpath = "github.com/Masterminds/sprig/v3",
sum = "h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8=",
version = "v3.2.2",
)

go_repository(
name = "com_github_matoous_godox",
build_file_proto_mode = "disable",
Expand Down Expand Up @@ -2807,6 +2877,14 @@ def go_deps():
sum = "h1:iGBIsUe3+HZ/AD/Vd7DErOt5sU9fa8Uj7A2s1aggv1Y=",
version = "v1.0.0",
)
go_repository(
name = "com_github_mitchellh_copystructure",
build_file_proto_mode = "disable",
importpath = "github.com/mitchellh/copystructure",
sum = "h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ=",
version = "v1.0.0",
)

go_repository(
name = "com_github_mitchellh_go_homedir",
build_file_proto_mode = "disable_global",
Expand Down Expand Up @@ -3466,10 +3544,6 @@ def go_deps():
name = "com_github_rivo_uniseg",
build_file_proto_mode = "disable_global",
importpath = "github.com/rivo/uniseg",
patch_args = ["-p1"],
patches = [
"//build/patches:com_github_rivo_uniseg.patch",
],
sum = "h1:YwD0ulJSJytLpiaWua0sBDusfsCZohxjxzVTYjwxfV8=",
version = "v0.4.2",
)
Expand Down Expand Up @@ -3668,8 +3742,8 @@ def go_deps():
name = "com_github_shopspring_decimal",
build_file_proto_mode = "disable",
importpath = "github.com/shopspring/decimal",
sum = "h1:pntxY8Ary0t43dCZ5dqY4YTJCObLY1kIXl0uzMv+7DE=",
version = "v0.0.0-20180709203117-cd690d0c9e24",
sum = "h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=",
version = "v1.2.0",
)

go_repository(
Expand Down Expand Up @@ -3822,6 +3896,14 @@ def go_deps():
sum = "h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ=",
version = "v1.12.0",
)
go_repository(
name = "com_github_spkg_bom",
build_file_proto_mode = "disable",
importpath = "github.com/spkg/bom",
sum = "h1:S939THe0ukL5WcTGiGqkgtaW5JW+O6ITaIlpJXTYY64=",
version = "v1.0.0",
)

go_repository(
name = "com_github_ssgreg_nlreturn_v2",
build_file_proto_mode = "disable",
Expand Down Expand Up @@ -5832,8 +5914,8 @@ def go_deps():
name = "org_golang_x_tools",
build_file_proto_mode = "disable_global",
importpath = "golang.org/x/tools",
sum = "h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=",
version = "v0.2.0",
sum = "h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4=",
version = "v0.5.0",
)
go_repository(
name = "org_golang_x_xerrors",
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dev: checklist check explaintest gogenerate br_unit_test test_part_parser_dev ut
# Install the check tools.
check-setup:tools/bin/revive

check: parser_yacc check-parallel lint tidy testSuite errdoc check-bazel-prepare
check: parser_yacc check-parallel lint tidy testSuite errdoc license check-bazel-prepare

fmt:
@echo "gofmt (simplify)"
Expand All @@ -56,6 +56,12 @@ lint:tools/bin/revive
@echo "linting"
@tools/bin/revive -formatter friendly -config tools/check/revive.toml $(FILES_TIDB_TESTS)

license:
bazel $(BAZEL_GLOBAL_CONFIG) run $(BAZEL_CMD_CONFIG) \
--run_under="cd $(CURDIR) && " \
@com_github_apache_skywalking_eyes//cmd/license-eye:license-eye --run_under="cd $(CURDIR) && " -- -c ./.github/licenserc.yml header check


tidy:
@echo "go mod tidy"
./tools/check/check-tidy.sh
Expand Down
12 changes: 6 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "56d8c5a5c91e1af73eca71a6fab2ced959b67c86d12ba37feedb0a2dfea441a6",
sha256 = "dd926a88a564a9246713a9c00b35315f54cbd46b31a26d5d8fb264c07045f05d",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.37.0/rules_go-v0.37.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.37.0/rules_go-v0.37.0.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.38.1/rules_go-v0.38.1.zip",
],
)

http_archive(
name = "bazel_gazelle",
sha256 = "501deb3d5695ab658e82f6f6f549ba681ea3ca2a5fb7911154b5aa45596183fa",
sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.26.0/bazel-gazelle-v0.26.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.26.0/bazel-gazelle-v0.26.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
],
)

Expand Down
2 changes: 1 addition & 1 deletion br/pkg/backup/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (ss *Schemas) BackupSchemas(

var checksum *checkpoint.ChecksumItem
var exists bool = false
if ss.checkpointChecksum != nil {
if ss.checkpointChecksum != nil && schema.tableInfo != nil {
checksum, exists = ss.checkpointChecksum[schema.tableInfo.ID]
}
workerPool.ApplyOnErrorGroup(errg, func() error {
Expand Down
44 changes: 42 additions & 2 deletions br/pkg/lightning/common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,49 @@ go_library(
"@org_golang_google_grpc//credentials",
"@org_golang_google_grpc//credentials/insecure",
"@org_golang_google_grpc//status",
"@org_golang_x_sys//unix",
"@org_uber_go_zap//:zap",
],
] + select({
"@io_bazel_rules_go//go/platform:aix": [
"@org_golang_x_sys//unix",
],
"@io_bazel_rules_go//go/platform:android": [
"@org_golang_x_sys//unix",
],
"@io_bazel_rules_go//go/platform:darwin": [
"@org_golang_x_sys//unix",
],
"@io_bazel_rules_go//go/platform:dragonfly": [
"@org_golang_x_sys//unix",
],
"@io_bazel_rules_go//go/platform:freebsd": [
"@org_golang_x_sys//unix",
],
"@io_bazel_rules_go//go/platform:illumos": [
"@org_golang_x_sys//unix",
],
"@io_bazel_rules_go//go/platform:ios": [
"@org_golang_x_sys//unix",
],
"@io_bazel_rules_go//go/platform:js": [
"@org_golang_x_sys//unix",
],
"@io_bazel_rules_go//go/platform:linux": [
"@org_golang_x_sys//unix",
],
"@io_bazel_rules_go//go/platform:netbsd": [
"@org_golang_x_sys//unix",
],
"@io_bazel_rules_go//go/platform:openbsd": [
"@org_golang_x_sys//unix",
],
"@io_bazel_rules_go//go/platform:plan9": [
"@org_golang_x_sys//unix",
],
"@io_bazel_rules_go//go/platform:solaris": [
"@org_golang_x_sys//unix",
],
"//conditions:default": [],
}),
)

go_test(
Expand Down
4 changes: 4 additions & 0 deletions br/pkg/lightning/common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const (
retryTimeout = 3 * time.Second

defaultMaxRetry = 3

dbTimeout = 30 * time.Second
)

// MySQLConnectParam records the parameters needed to connect to a MySQL database.
Expand Down Expand Up @@ -74,6 +76,8 @@ func (param *MySQLConnectParam) ToDriverConfig() *mysql.Config {
cfg.Params["charset"] = "utf8mb4"
cfg.Params["sql_mode"] = fmt.Sprintf("'%s'", param.SQLMode)
cfg.MaxAllowedPacket = int(param.MaxAllowedPacket)
cfg.ReadTimeout = dbTimeout
cfg.WriteTimeout = dbTimeout

cfg.TLS = param.TLSConfig
cfg.AllowFallbackToPlaintext = param.AllowFallbackToPlaintext
Expand Down
2 changes: 2 additions & 0 deletions br/pkg/lightning/config/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ go_library(
"@com_github_docker_go_units//:go-units",
"@com_github_go_sql_driver_mysql//:mysql",
"@com_github_pingcap_errors//:errors",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//keepalive",
"@org_uber_go_atomic//:atomic",
"@org_uber_go_zap//:zap",
],
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ func TestLoadConfig(t *testing.T) {
err = taskCfg.Adjust(context.Background())
require.NoError(t, err)
equivalentDSN := taskCfg.Checkpoint.MySQLParam.ToDriverConfig().FormatDSN()
expectedDSN := "guest:12345@tcp(172.16.30.11:4001)/?maxAllowedPacket=67108864&charset=utf8mb4&sql_mode=%27ONLY_FULL_GROUP_BY%2CSTRICT_TRANS_TABLES%2CNO_ZERO_IN_DATE%2CNO_ZERO_DATE%2CERROR_FOR_DIVISION_BY_ZERO%2CNO_AUTO_CREATE_USER%2CNO_ENGINE_SUBSTITUTION%27"
expectedDSN := "guest:12345@tcp(172.16.30.11:4001)/?readTimeout=30s&writeTimeout=30s&maxAllowedPacket=67108864&charset=utf8mb4&sql_mode=%27ONLY_FULL_GROUP_BY%2CSTRICT_TRANS_TABLES%2CNO_ZERO_IN_DATE%2CNO_ZERO_DATE%2CERROR_FOR_DIVISION_BY_ZERO%2CNO_AUTO_CREATE_USER%2CNO_ENGINE_SUBSTITUTION%27"
require.Equal(t, expectedDSN, equivalentDSN)

result := taskCfg.String()
Expand Down
Loading

0 comments on commit 38d4e36

Please sign in to comment.