Skip to content

Commit

Permalink
Merge branch 'master' into fix-35856
Browse files Browse the repository at this point in the history
  • Loading branch information
Defined2014 authored Jul 22, 2022
2 parents 15de476 + eaead02 commit db4f344
Show file tree
Hide file tree
Showing 221 changed files with 5,718 additions and 5,073 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@ bazel_test: failpoint-enable bazel_ci_prepare


bazel_coverage_test: failpoint-enable bazel_ci_prepare
bazel --output_user_root=/home/jenkins/.tidb/tmp coverage --config=ci --@io_bazel_rules_go//go/config:cover_format=go_cover \
bazel --output_user_root=/home/jenkins/.tidb/tmp coverage --config=ci --build_event_json_file=bazel_1.json --@io_bazel_rules_go//go/config:cover_format=go_cover \
-- //... -//cmd/... -//tests/graceshutdown/... \
-//tests/globalkilltest/... -//tests/readonlytest/... -//br/pkg/task:task_test
bazel --output_user_root=/home/jenkins/.tidb/tmp coverage --config=ci --@io_bazel_rules_go//go/config:cover_format=go_cover --define gotags=featuretag \
bazel --output_user_root=/home/jenkins/.tidb/tmp coverage --config=ci --build_event_json_file=bazel_2.json --@io_bazel_rules_go//go/config:cover_format=go_cover --define gotags=featuretag \
-- //... -//cmd/... -//tests/graceshutdown/... \
-//tests/globalkilltest/... -//tests/readonlytest/... -//br/pkg/task:task_test

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The asterisk (*) indicates the required field.

The TiDB security team will confirm the vulnerabilities and contact you within 2 working days after your submission.

We will publicly thank you after fixing the security vulnerability. To avoid negative impact, please keep the vulnerability confidential until we fix it. We would appreciate it if you could obey the following code of conduct:
We will publicly thank you once the security vulnerability has been fixed. To avoid negative impact, please keep the vulnerability confidential until we fix it. We would appreciate it if you could obey the following code of conduct:

The vulnerability will not be disclosed until TiDB releases a patch for it.

Expand Down
1 change: 1 addition & 0 deletions bindinfo/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ go_test(
"temptable_test.go",
],
embed = [":bindinfo"],
flaky = True,
deps = [
"//config",
"//domain",
Expand Down
1 change: 1 addition & 0 deletions br/cmd/br/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ go_test(
name = "br_test",
srcs = ["main_test.go"],
embed = [":br_lib"],
flaky = True,
)
1 change: 1 addition & 0 deletions br/cmd/tidb-lightning-ctl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ go_test(
name = "tidb-lightning-ctl_test",
srcs = ["main_test.go"],
embed = [":tidb-lightning-ctl_lib"],
flaky = True,
)
1 change: 1 addition & 0 deletions br/cmd/tidb-lightning/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ go_test(
name = "tidb-lightning_test",
srcs = ["main_test.go"],
embed = [":tidb-lightning_lib"],
flaky = True,
)
1 change: 1 addition & 0 deletions br/pkg/backup/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ go_test(
"schema_test.go",
],
embed = [":backup"],
flaky = True,
deps = [
"//br/pkg/conn",
"//br/pkg/metautil",
Expand Down
1 change: 1 addition & 0 deletions br/pkg/checksum/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ go_test(
"main_test.go",
],
embed = [":checksum"],
flaky = True,
deps = [
"//br/pkg/backup",
"//br/pkg/metautil",
Expand Down
2 changes: 2 additions & 0 deletions br/pkg/conn/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ go_library(
"//br/pkg/version",
"//domain",
"//kv",
"//util/engine",
"@com_github_docker_go_units//:go-units",
"@com_github_opentracing_opentracing_go//:opentracing-go",
"@com_github_pingcap_errors//:errors",
Expand Down Expand Up @@ -41,6 +42,7 @@ go_test(
"main_test.go",
],
embed = [":conn"],
flaky = True,
deps = [
"//br/pkg/pdutil",
"//br/pkg/utils",
Expand Down
3 changes: 2 additions & 1 deletion br/pkg/conn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/pingcap/tidb/br/pkg/version"
"github.com/pingcap/tidb/domain"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/util/engine"
"github.com/tikv/client-go/v2/oracle"
"github.com/tikv/client-go/v2/tikv"
"github.com/tikv/client-go/v2/txnkv/txnlock"
Expand Down Expand Up @@ -100,7 +101,7 @@ func GetAllTiKVStores(
j := 0
for _, store := range stores {
isTiFlash := false
if version.IsTiFlash(store) {
if engine.IsTiFlash(store) {
if storeBehavior == SkipTiFlash {
continue
} else if storeBehavior == ErrorOnTiFlash {
Expand Down
1 change: 1 addition & 0 deletions br/pkg/errors/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ go_library(
go_test(
name = "errors_test",
srcs = ["errors_test.go"],
flaky = True,
deps = [
":errors",
"@com_github_pingcap_errors//:errors",
Expand Down
1 change: 1 addition & 0 deletions br/pkg/glue/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ go_library(
go_test(
name = "glue_test",
srcs = ["console_glue_test.go"],
flaky = True,
deps = [
":glue",
"@com_github_fatih_color//:color",
Expand Down
1 change: 1 addition & 0 deletions br/pkg/gluetikv/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ go_test(
name = "gluetikv_test",
srcs = ["glue_test.go"],
embed = [":gluetikv"],
flaky = True,
deps = ["@com_github_stretchr_testify//require"],
)
1 change: 1 addition & 0 deletions br/pkg/lightning/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ go_test(
"main_test.go",
],
embed = [":lightning"],
flaky = True,
deps = [
"//br/pkg/lightning/checkpoints",
"//br/pkg/lightning/config",
Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/backend/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ go_library(
go_test(
name = "backend_test",
srcs = ["backend_test.go"],
flaky = True,
deps = [
":backend",
"//br/pkg/lightning/backend/kv",
Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/backend/kv/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ go_test(
"sql2kv_test.go",
],
embed = [":kv"],
flaky = True,
deps = [
"//br/pkg/lightning/common",
"//br/pkg/lightning/log",
Expand Down
4 changes: 3 additions & 1 deletion br/pkg/lightning/backend/local/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ go_library(
"//table",
"//tablecodec",
"//util/codec",
"//util/engine",
"//util/hack",
"//util/mathutil",
"//util/ranger",
Expand Down Expand Up @@ -88,6 +89,7 @@ go_test(
"localhelper_test.go",
],
embed = [":local"],
flaky = True,
deps = [
"//br/pkg/lightning/backend",
"//br/pkg/lightning/backend/kv",
Expand All @@ -100,14 +102,14 @@ go_test(
"//br/pkg/pdutil",
"//br/pkg/restore",
"//br/pkg/utils",
"//br/pkg/version",
"//kv",
"//parser/mysql",
"//sessionctx/stmtctx",
"//store/pdtypes",
"//tablecodec",
"//types",
"//util/codec",
"//util/engine",
"//util/hack",
"@com_github_cockroachdb_pebble//:pebble",
"@com_github_cockroachdb_pebble//sstable",
Expand Down
7 changes: 4 additions & 3 deletions br/pkg/lightning/backend/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import (
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/tablecodec"
"github.com/pingcap/tidb/util/codec"
"github.com/pingcap/tidb/util/engine"
"github.com/pingcap/tidb/util/mathutil"
tikverror "github.com/tikv/client-go/v2/error"
"github.com/tikv/client-go/v2/oracle"
Expand Down Expand Up @@ -501,15 +502,15 @@ func (local *local) checkMultiIngestSupport(ctx context.Context) error {

hasTiFlash := false
for _, s := range stores {
if s.State == metapb.StoreState_Up && version.IsTiFlash(s) {
if s.State == metapb.StoreState_Up && engine.IsTiFlash(s) {
hasTiFlash = true
break
}
}

for _, s := range stores {
// skip stores that are not online
if s.State != metapb.StoreState_Up || version.IsTiFlash(s) {
if s.State != metapb.StoreState_Up || engine.IsTiFlash(s) {
continue
}
var err error
Expand Down Expand Up @@ -1994,7 +1995,7 @@ func getRegionSplitSizeKeys(ctx context.Context, cli pd.Client, tls *common.TLS)
return 0, 0, err
}
for _, store := range stores {
if store.StatusAddress == "" || version.IsTiFlash(store) {
if store.StatusAddress == "" || engine.IsTiFlash(store) {
continue
}
serverInfo := infoschema.ServerInfo{
Expand Down
14 changes: 7 additions & 7 deletions br/pkg/lightning/backend/local/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ import (
"github.com/pingcap/tidb/br/pkg/pdutil"
"github.com/pingcap/tidb/br/pkg/restore"
"github.com/pingcap/tidb/br/pkg/utils"
"github.com/pingcap/tidb/br/pkg/version"
tidbkv "github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/sessionctx/stmtctx"
"github.com/pingcap/tidb/tablecodec"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/codec"
"github.com/pingcap/tidb/util/engine"
"github.com/pingcap/tidb/util/hack"
"github.com/stretchr/testify/require"
pd "github.com/tikv/pd/client"
Expand Down Expand Up @@ -1022,7 +1022,7 @@ func TestMultiIngest(t *testing.T) {
return store.State == metapb.StoreState_Up
},
func(s *metapb.Store) bool {
return !version.IsTiFlash(s)
return !engine.IsTiFlash(s)
},
0,
nil,
Expand All @@ -1035,7 +1035,7 @@ func TestMultiIngest(t *testing.T) {
return store.State == metapb.StoreState_Up
},
func(s *metapb.Store) bool {
return version.IsTiFlash(s)
return engine.IsTiFlash(s)
},
0,
nil,
Expand Down Expand Up @@ -1071,10 +1071,10 @@ func TestMultiIngest(t *testing.T) {
// test all non-tiflash stores that support multi ingests
{
func(store *metapb.Store) bool {
return !version.IsTiFlash(store)
return !engine.IsTiFlash(store)
},
func(s *metapb.Store) bool {
return !version.IsTiFlash(s)
return !engine.IsTiFlash(s)
},
0,
nil,
Expand Down Expand Up @@ -1110,7 +1110,7 @@ func TestMultiIngest(t *testing.T) {
// test grpc return error but no tiflash
{
func(store *metapb.Store) bool {
return !version.IsTiFlash(store)
return !engine.IsTiFlash(store)
},
func(s *metapb.Store) bool {
return true
Expand All @@ -1123,7 +1123,7 @@ func TestMultiIngest(t *testing.T) {
// test grpc return error and contains offline tiflash
{
func(store *metapb.Store) bool {
return !version.IsTiFlash(store) || store.State != metapb.StoreState_Up
return !engine.IsTiFlash(store) || store.State != metapb.StoreState_Up
},
func(s *metapb.Store) bool {
return true
Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/backend/tidb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ go_library(
go_test(
name = "tidb_test",
srcs = ["tidb_test.go"],
flaky = True,
deps = [
":tidb",
"//br/pkg/lightning/backend",
Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/checkpoints/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ go_test(
"main_test.go",
],
embed = [":checkpoints"],
flaky = True,
deps = [
"//br/pkg/lightning/checkpoints/checkpointspb",
"//br/pkg/lightning/config",
Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/common/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ go_test(
"util_test.go",
],
embed = [":common"],
flaky = True,
deps = [
"//br/pkg/errors",
"//br/pkg/lightning/log",
Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/config/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ go_test(
"config_test.go",
"configlist_test.go",
],
flaky = True,
deps = [
":config",
"//parser/mysql",
Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/errormanager/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ go_test(
name = "errormanager_test",
srcs = ["errormanager_test.go"],
embed = [":errormanager"],
flaky = True,
deps = [
"//br/pkg/lightning/config",
"//br/pkg/lightning/log",
Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/log/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ go_test(
"filter_test.go",
"log_test.go",
],
flaky = True,
importpath = "github.com/pingcap/tidb/br/pkg/lightning/log_test",
deps = [
":log",
Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/metric/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ go_library(
go_test(
name = "metric_test",
srcs = ["metric_test.go"],
flaky = True,
deps = [
":metric",
"//util/promutil",
Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/mydump/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ go_test(
"examples/*",
]),
embed = [":mydump"],
flaky = True,
deps = [
"//br/pkg/lightning/config",
"//br/pkg/lightning/log",
Expand Down
2 changes: 2 additions & 0 deletions br/pkg/lightning/restore/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ go_library(
"//table/tables",
"//types",
"//util/collate",
"//util/engine",
"//util/mathutil",
"//util/mock",
"@com_github_coreos_go_semver//semver",
Expand Down Expand Up @@ -91,6 +92,7 @@ go_test(
"tidb_test.go",
],
embed = [":restore"],
flaky = True,
deps = [
"//br/pkg/lightning/backend",
"//br/pkg/lightning/backend/kv",
Expand Down
14 changes: 3 additions & 11 deletions br/pkg/lightning/restore/check_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/pingcap/tidb/store/pdtypes"
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/engine"
"github.com/pingcap/tidb/util/mathutil"
"go.uber.org/zap"
"golang.org/x/exp/slices"
Expand Down Expand Up @@ -169,15 +170,6 @@ func (rc *Controller) ClusterIsAvailable(ctx context.Context) {
}
}

func isTiFlash(store *pdtypes.MetaStore) bool {
for _, label := range store.Labels {
if label.Key == "engine" && label.Value == "tiflash" {
return true
}
}
return false
}

func (rc *Controller) checkEmptyRegion(ctx context.Context) error {
passed := true
message := "Cluster doesn't have too many empty regions"
Expand Down Expand Up @@ -228,7 +220,7 @@ func (rc *Controller) checkEmptyRegion(ctx context.Context) error {
if metapb.StoreState(metapb.StoreState_value[store.Store.StateName]) != metapb.StoreState_Up {
continue
}
if isTiFlash(store.Store) {
if engine.IsTiFlash(store.Store.Store) {
continue
}
if regionCnt > errorThrehold {
Expand Down Expand Up @@ -272,7 +264,7 @@ func (rc *Controller) checkRegionDistribution(ctx context.Context) error {
if metapb.StoreState(metapb.StoreState_value[store.Store.StateName]) != metapb.StoreState_Up {
continue
}
if isTiFlash(store.Store) {
if engine.IsTiFlash(store.Store.Store) {
continue
}
stores = append(stores, store)
Expand Down
Loading

0 comments on commit db4f344

Please sign in to comment.