Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dep: update tidb package (#11198) #11405

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions dm/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ func (c *Checker) Process(ctx context.Context, pr chan pb.ProcessResult) {
}
warnLeft, errLeft := c.warnCnt, c.errCnt

<<<<<<< HEAD
// remove success result if not pass
results := result.Results[:0]
for _, r := range result.Results {
Expand Down Expand Up @@ -655,6 +656,9 @@ func (c *Checker) Process(ctx context.Context, pr chan pb.ProcessResult) {
}
}
result.Results = results
=======
filterResults(result, c.warnCnt, c.errCnt, false)
>>>>>>> 92e2909787 (dep: update tidb package (#11198))

c.updateInstruction(result)

Expand Down Expand Up @@ -682,6 +686,69 @@ func (c *Checker) Process(ctx context.Context, pr chan pb.ProcessResult) {
}
}

<<<<<<< HEAD
=======
func filterResults(
result *checker.Results,
warnCnt, errCnt int64,
keepSuccessWhenNoFailure bool,
) {
// remove success result if not pass
results := result.Results[:0]
for _, r := range result.Results {
if r.State == checker.StateSuccess {
continue
}

// handle results without r.Errors
if len(r.Errors) == 0 {
switch r.State {
case checker.StateWarning:
if warnCnt == 0 {
continue
}
warnCnt--
results = append(results, r)
case checker.StateFailure:
if errCnt == 0 {
continue
}
errCnt--
results = append(results, r)
}
continue
}

subErrors := make([]*checker.Error, 0, len(r.Errors))
for _, e := range r.Errors {
switch e.Severity {
case checker.StateWarning:
if warnCnt == 0 {
continue
}
warnCnt--
subErrors = append(subErrors, e)
case checker.StateFailure:
if errCnt == 0 {
continue
}
errCnt--
subErrors = append(subErrors, e)
}
}
// skip display an empty Result
if len(subErrors) > 0 {
r.Errors = subErrors
results = append(results, r)
}
}
if keepSuccessWhenNoFailure && len(results) == 0 {
return
}
result.Results = results
}

>>>>>>> 92e2909787 (dep: update tidb package (#11198))
// updateInstruction updates the check result's Instruction.
func (c *Checker) updateInstruction(result *checker.Results) {
for _, r := range result.Results {
Expand Down
27 changes: 27 additions & 0 deletions dm/checker/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,30 @@ func RunCheckOnConfigs(

return checker.Do(ctx, c.checkList)
}
<<<<<<< HEAD
=======

// RunCheckOnConfigs returns the check result for given subtask configs. Caller
// should be noticed that result may be very large. The result will be truncated
// to `warnLimit` and `errLimit`, but the total count in summary will be the same
// as the original result.
//
// when `dumpWholeInstance` is true, checker will require SELECT ON *.*
// privileges for SourceDumpPrivilegeChecker.
//
// This function is used by cloud services.
func RunCheckOnConfigs(
ctx context.Context,
cfgs []*config.SubTaskConfig,
dumpWholeInstance bool,
warnLimit, errLimit int64,
) (*checker.Results, error) {
result, err := runCheckOnConfigs(ctx, cfgs, dumpWholeInstance)
if err != nil || result == nil {
return result, err
}

filterResults(result, warnLimit, errLimit, true)
return result, nil
}
>>>>>>> 92e2909787 (dep: update tidb package (#11198))
2 changes: 1 addition & 1 deletion dm/tests/check_task/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function test_privileges_can_migrate() {
run_sql_source1 "create table checktask1.test_privilege(id int primary key, b varchar(10))"
run_sql_source1 "insert into checktask1.test_privilege values (1, 'a'),(2, 'b');"
run_sql_tidb "create user 'test1'@'%' identified by '123456';"
run_sql_tidb "grant select, create, insert, update, delete, alter, drop, index, config on *.* to 'test1'@'%';"
run_sql_tidb "grant select, create, insert, update, delete, alter, drop, index, config, create view on *.* to 'test1'@'%';"
run_sql_tidb "flush privileges;"
run_dm_ctl $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"start-task $cur/conf/task-priv.yaml --remove-meta" \
Expand Down
38 changes: 37 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,22 @@ require (
github.com/pierrec/lz4/v4 v4.1.18
github.com/pingcap/check v0.0.0-20211026125417-57bd13f7b5f0
github.com/pingcap/errors v0.11.5-0.20240318064555-6bd07397691f
<<<<<<< HEAD
github.com/pingcap/failpoint v0.0.0-20240412033321-fd0796e60f86
github.com/pingcap/kvproto v0.0.0-20240522024016-df42997c2c57
github.com/pingcap/log v1.1.1-0.20240314023424-862ccc32f18d
github.com/pingcap/tidb v1.1.0-beta.0.20240527072219-a97e6464c01d
github.com/pingcap/tidb/pkg/parser v0.0.0-20240527072219-a97e6464c01d
github.com/prometheus/client_golang v1.19.1
=======
github.com/pingcap/failpoint v0.0.0-20240527053858-9b3b6e34194a
github.com/pingcap/kvproto v0.0.0-20240227073058-929ab83f9754
github.com/pingcap/log v1.1.1-0.20240314023424-862ccc32f18d
github.com/pingcap/tidb v1.1.0-beta.0.20240530025951-afd8de1f6218
github.com/pingcap/tidb-dashboard v0.0.0-20240326110213-9768844ff5d7
github.com/pingcap/tidb/pkg/parser v0.0.0-20240530025951-afd8de1f6218
github.com/prometheus/client_golang v1.19.0
>>>>>>> 92e2909787 (dep: update tidb package (#11198))
github.com/prometheus/client_model v0.6.1
github.com/r3labs/diff v1.1.0
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
Expand Down Expand Up @@ -127,6 +137,8 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.0.0 // indirect
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/apache/arrow/go/v12 v12.0.1 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.6 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.36 // indirect
Expand All @@ -149,25 +161,49 @@ require (
github.com/go-ldap/ldap/v3 v3.4.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
<<<<<<< HEAD
=======
github.com/go-resty/resty/v2 v2.11.0 // indirect
github.com/goccy/go-reflect v1.2.0 // indirect
>>>>>>> 92e2909787 (dep: update tidb package (#11198))
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
github.com/google/flatbuffers v2.0.8+incompatible // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/iancoleman/strcase v0.2.0 // indirect
github.com/influxdata/tdigest v0.0.1 // indirect
github.com/jellydator/ttlcache/v3 v3.0.1 // indirect
<<<<<<< HEAD
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/ks3sdklib/aws-sdk-go v1.2.6 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
=======
github.com/jfcg/sixb v1.3.8 // indirect
github.com/jfcg/sorty/v2 v2.1.0 // indirect
github.com/joomcode/errorx v1.0.1 // indirect
github.com/klauspost/asmfmt v1.3.2 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/ks3sdklib/aws-sdk-go v1.2.9 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect
github.com/otiai10/copy v1.2.0 // indirect
>>>>>>> 92e2909787 (dep: update tidb package (#11198))
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.22.0 // indirect
golang.org/x/arch v0.3.0 // indirect
<<<<<<< HEAD
google.golang.org/appengine v1.6.8 // indirect
=======
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
>>>>>>> 92e2909787 (dep: update tidb package (#11198))
google.golang.org/genproto v0.0.0-20240401170217-c3f982113cda // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/api v0.28.6 // indirect
Expand Down Expand Up @@ -341,7 +377,7 @@ require (
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/xdg/stringprep v1.0.3 // indirect
github.com/xiang90/probing v0.0.0-20221125231312-a49e3df8f510 // indirect
github.com/xitongsys/parquet-go v1.6.0 // indirect
github.com/xitongsys/parquet-go v1.6.3-0.20240520233950-75e935fc3e17 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.etcd.io/bbolt v1.3.9 // indirect
go.etcd.io/etcd/client/v2 v2.305.12 // indirect
Expand Down
Loading
Loading