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

lightning: mark background and resource group name when in local mode #44950

Merged
merged 21 commits into from
Jul 28, 2023
Merged
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
48 changes: 24 additions & 24 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1711,13 +1711,13 @@ def go_deps():
name = "com_github_elastic_gosigar",
build_file_proto_mode = "disable_global",
importpath = "github.com/elastic/gosigar",
sha256 = "ba59c159fd8b4c64f34dd0c915df96d39f7f5d5e21f9ae2d9639793828a67e18",
strip_prefix = "github.com/elastic/gosigar@v0.14.2",
sha256 = "21ddafe5b9912113983e4210aa48f12a87d3a88a0a6946601e65725b736ca852",
strip_prefix = "github.com/elastic/gosigar@v0.9.0",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/github.com/elastic/gosigar/com_github_elastic_gosigar-v0.14.2.zip",
"http://ats.apps.svc/gomod/github.com/elastic/gosigar/com_github_elastic_gosigar-v0.14.2.zip",
"https://cache.hawkingrei.com/gomod/github.com/elastic/gosigar/com_github_elastic_gosigar-v0.14.2.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/elastic/gosigar/com_github_elastic_gosigar-v0.14.2.zip",
"http://bazel-cache.pingcap.net:8080/gomod/github.com/elastic/gosigar/com_github_elastic_gosigar-v0.9.0.zip",
"http://ats.apps.svc/gomod/github.com/elastic/gosigar/com_github_elastic_gosigar-v0.9.0.zip",
"https://cache.hawkingrei.com/gomod/github.com/elastic/gosigar/com_github_elastic_gosigar-v0.9.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/elastic/gosigar/com_github_elastic_gosigar-v0.9.0.zip",
],
)
go_repository(
Expand Down Expand Up @@ -6924,26 +6924,26 @@ def go_deps():
name = "com_github_tikv_client_go_v2",
build_file_proto_mode = "disable_global",
importpath = "github.com/tikv/client-go/v2",
sha256 = "fda64379a1d2f8bc263aa1e9faac235a59c085bc06269a46a88f3dd60e37d372",
strip_prefix = "github.com/tikv/client-go/v2@v2.0.8-0.20230714052714-85fc8f337565",
sha256 = "2dcd0fa5258d9cf2dedf7a5d6066c9c221707c269f895824b05a5be4af721263",
strip_prefix = "github.com/tikv/client-go/v2@v2.0.8-0.20230726071354-76d6d93e9856",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230714052714-85fc8f337565.zip",
"http://ats.apps.svc/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230714052714-85fc8f337565.zip",
"https://cache.hawkingrei.com/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230714052714-85fc8f337565.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230714052714-85fc8f337565.zip",
"http://bazel-cache.pingcap.net:8080/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230726071354-76d6d93e9856.zip",
"http://ats.apps.svc/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230726071354-76d6d93e9856.zip",
"https://cache.hawkingrei.com/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230726071354-76d6d93e9856.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/client-go/v2/com_github_tikv_client_go_v2-v2.0.8-0.20230726071354-76d6d93e9856.zip",
],
)
go_repository(
name = "com_github_tikv_pd_client",
build_file_proto_mode = "disable_global",
importpath = "github.com/tikv/pd/client",
sha256 = "6cdab562dd442f33d5c4fca3999c8e7fafca1ae28a55cbd597ede42a9adef249",
strip_prefix = "github.com/tikv/pd/client@v0.0.0-20230613052906-7158cb319935",
sha256 = "401dddb69309b07fa9d4464adeaf5d98a456dda622114fd479d01d18ab622cbc",
strip_prefix = "github.com/tikv/pd/client@v0.0.0-20230724080549-de985b8e0afc",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20230613052906-7158cb319935.zip",
"http://ats.apps.svc/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20230613052906-7158cb319935.zip",
"https://cache.hawkingrei.com/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20230613052906-7158cb319935.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20230613052906-7158cb319935.zip",
"http://bazel-cache.pingcap.net:8080/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20230724080549-de985b8e0afc.zip",
"http://ats.apps.svc/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20230724080549-de985b8e0afc.zip",
"https://cache.hawkingrei.com/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20230724080549-de985b8e0afc.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20230724080549-de985b8e0afc.zip",
],
)
go_repository(
Expand Down Expand Up @@ -10035,13 +10035,13 @@ def go_deps():
name = "org_golang_x_exp",
build_file_proto_mode = "disable_global",
importpath = "golang.org/x/exp",
sha256 = "1bac2a4c8fb2891f3db33d4beeb04b4fcc3b1e00733f67a58c3d5942e21b4ff2",
strip_prefix = "golang.org/x/exp@v0.0.0-20230519143937-03e91628a987",
sha256 = "d4b6a3cc6bf072a05030324328169b5f878f7be012508fff618e251cccb3d0aa",
strip_prefix = "golang.org/x/exp@v0.0.0-20230711005742-c3f37128e5a4",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/golang.org/x/exp/org_golang_x_exp-v0.0.0-20230519143937-03e91628a987.zip",
"http://ats.apps.svc/gomod/golang.org/x/exp/org_golang_x_exp-v0.0.0-20230519143937-03e91628a987.zip",
"https://cache.hawkingrei.com/gomod/golang.org/x/exp/org_golang_x_exp-v0.0.0-20230519143937-03e91628a987.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/golang.org/x/exp/org_golang_x_exp-v0.0.0-20230519143937-03e91628a987.zip",
"http://bazel-cache.pingcap.net:8080/gomod/golang.org/x/exp/org_golang_x_exp-v0.0.0-20230711005742-c3f37128e5a4.zip",
"http://ats.apps.svc/gomod/golang.org/x/exp/org_golang_x_exp-v0.0.0-20230711005742-c3f37128e5a4.zip",
"https://cache.hawkingrei.com/gomod/golang.org/x/exp/org_golang_x_exp-v0.0.0-20230711005742-c3f37128e5a4.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/golang.org/x/exp/org_golang_x_exp-v0.0.0-20230711005742-c3f37128e5a4.zip",
],
)
go_repository(
Expand Down
2 changes: 1 addition & 1 deletion br/cmd/tidb-lightning-ctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
tls.WithHost(cfg.TiDB.PdAddr),
tikv.StoreStateDisconnected,
func(c context.Context, store *tikv.Store) error {
return tikv.Compact(c, tls, store.Address, importer.FullLevelCompact)
return tikv.Compact(c, tls, store.Address, importer.FullLevelCompact, "")

Check warning on line 131 in br/cmd/tidb-lightning-ctl/main.go

View check run for this annotation

Codecov / codecov/patch

br/cmd/tidb-lightning-ctl/main.go#L131

Added line #L131 was not covered by tests
},
)
}
Expand Down
35 changes: 31 additions & 4 deletions br/pkg/checksum/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@

oldKeyspace []byte
newKeyspace []byte

resourceGroupName string
explicitRequestSourceType string
}

// NewExecutorBuilder returns a new executor builder.
Expand Down Expand Up @@ -73,6 +76,16 @@
return builder
}

func (builder *ExecutorBuilder) SetResourceGroupName(name string) *ExecutorBuilder {
builder.resourceGroupName = name
return builder
}

func (builder *ExecutorBuilder) SetExplicitRequestSourceType(name string) *ExecutorBuilder {
builder.explicitRequestSourceType = name
return builder
}

// Build builds a checksum executor.
func (builder *ExecutorBuilder) Build() (*Executor, error) {
reqs, err := buildChecksumRequest(
Expand All @@ -82,6 +95,8 @@
builder.concurrency,
builder.oldKeyspace,
builder.newKeyspace,
builder.resourceGroupName,
lance6716 marked this conversation as resolved.
Show resolved Hide resolved
builder.explicitRequestSourceType,
)
if err != nil {
return nil, errors.Trace(err)
Expand All @@ -96,6 +111,7 @@
concurrency uint,
oldKeyspace []byte,
newKeyspace []byte,
resourceGroupName, explicitRequestSourceType string,
) ([]*kv.Request, error) {
var partDefs []model.PartitionDefinition
if part := newTable.Partition; part != nil {
Expand All @@ -107,7 +123,8 @@
if oldTable != nil {
oldTableID = oldTable.Info.ID
}
rs, err := buildRequest(newTable, newTable.ID, oldTable, oldTableID, startTS, concurrency, oldKeyspace, newKeyspace)
rs, err := buildRequest(newTable, newTable.ID, oldTable, oldTableID, startTS, concurrency,
oldKeyspace, newKeyspace, resourceGroupName, explicitRequestSourceType)
if err != nil {
return nil, errors.Trace(err)
}
Expand All @@ -122,7 +139,8 @@
}
}
}
rs, err := buildRequest(newTable, partDef.ID, oldTable, oldPartID, startTS, concurrency, oldKeyspace, newKeyspace)
rs, err := buildRequest(newTable, partDef.ID, oldTable, oldPartID, startTS, concurrency,
oldKeyspace, newKeyspace, resourceGroupName, explicitRequestSourceType)

Check warning on line 143 in br/pkg/checksum/executor.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/checksum/executor.go#L142-L143

Added lines #L142 - L143 were not covered by tests
if err != nil {
return nil, errors.Trace(err)
}
Expand All @@ -141,9 +159,11 @@
concurrency uint,
oldKeyspace []byte,
newKeyspace []byte,
resourceGroupName, explicitRequestSourceType string,
) ([]*kv.Request, error) {
reqs := make([]*kv.Request, 0)
req, err := buildTableRequest(tableInfo, tableID, oldTable, oldTableID, startTS, concurrency, oldKeyspace, newKeyspace)
req, err := buildTableRequest(tableInfo, tableID, oldTable, oldTableID, startTS, concurrency,
oldKeyspace, newKeyspace, resourceGroupName, explicitRequestSourceType)
if err != nil {
return nil, errors.Trace(err)
}
Expand Down Expand Up @@ -172,7 +192,8 @@
}
}
req, err = buildIndexRequest(
tableID, indexInfo, oldTableID, oldIndexInfo, startTS, concurrency, oldKeyspace, newKeyspace)
tableID, indexInfo, oldTableID, oldIndexInfo, startTS, concurrency,
oldKeyspace, newKeyspace, resourceGroupName, explicitRequestSourceType)
if err != nil {
return nil, errors.Trace(err)
}
Expand All @@ -191,6 +212,7 @@
concurrency uint,
oldKeyspace []byte,
newKeyspace []byte,
resourceGroupName, explicitRequestSourceType string,
) (*kv.Request, error) {
var rule *tipb.ChecksumRewriteRule
if oldTable != nil {
Expand Down Expand Up @@ -220,6 +242,8 @@
SetStartTS(startTS).
SetChecksumRequest(checksum).
SetConcurrency(int(concurrency)).
SetResourceGroupName(resourceGroupName).
SetExplicitRequestSourceType(explicitRequestSourceType).
Build()
}

Expand All @@ -232,6 +256,7 @@
concurrency uint,
oldKeyspace []byte,
newKeyspace []byte,
resourceGroupName, ExplicitRequestSourceType string,
) (*kv.Request, error) {
var rule *tipb.ChecksumRewriteRule
if oldIndexInfo != nil {
Expand All @@ -257,6 +282,8 @@
SetStartTS(startTS).
SetChecksumRequest(checksum).
SetConcurrency(int(concurrency)).
SetResourceGroupName(resourceGroupName).
SetExplicitRequestSourceType(ExplicitRequestSourceType).
Build()
}

Expand Down
4 changes: 2 additions & 2 deletions br/pkg/gluetidb/glue.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (gs *tidbSession) ExecuteInternal(ctx context.Context, sql string, args ...
vars.TxnCtxMu.Unlock()
}()
// Some of SQLs (like ADMIN RECOVER INDEX) may lazily take effect
// when we polling the result set.
// when we are polling the result set.
// At least call `next` once for triggering theirs side effect.
// (Maybe we'd better drain all returned rows?)
if rs != nil {
Expand Down Expand Up @@ -379,7 +379,7 @@ func (s *mockSession) ExecuteInternal(ctx context.Context, sql string, args ...i
return err
}
// Some of SQLs (like ADMIN RECOVER INDEX) may lazily take effect
// when we polling the result set.
// when we are polling the result set.
// At least call `next` once for triggering theirs side effect.
// (Maybe we'd better drain all returned rows?)
if rs != nil {
Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/backend/local/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ go_library(
"@com_github_tikv_client_go_v2//kv",
"@com_github_tikv_client_go_v2//oracle",
"@com_github_tikv_client_go_v2//tikv",
"@com_github_tikv_client_go_v2//util",
"@com_github_tikv_pd_client//:client",
"@org_golang_google_grpc//:grpc",
"@org_golang_google_grpc//backoff",
Expand Down
24 changes: 15 additions & 9 deletions br/pkg/lightning/backend/local/checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,28 +268,34 @@

// TiKVChecksumManager is a manager that can compute checksum of a table using TiKV.
type TiKVChecksumManager struct {
client kv.Client
manager gcTTLManager
distSQLScanConcurrency uint
backoffWeight int
client kv.Client
manager gcTTLManager
distSQLScanConcurrency uint
backoffWeight int
resourceGroupName string
explicitRequestSourceType string
}

var _ ChecksumManager = &TiKVChecksumManager{}

// NewTiKVChecksumManager return a new tikv checksum manager
func NewTiKVChecksumManager(client kv.Client, pdClient pd.Client, distSQLScanConcurrency uint, backoffWeight int) *TiKVChecksumManager {
func NewTiKVChecksumManager(client kv.Client, pdClient pd.Client, distSQLScanConcurrency uint, backoffWeight int, resourceGroupName, explicitRequestSourceType string) *TiKVChecksumManager {

Check warning on line 282 in br/pkg/lightning/backend/local/checksum.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/lightning/backend/local/checksum.go#L282

Added line #L282 was not covered by tests
return &TiKVChecksumManager{
client: client,
manager: newGCTTLManager(pdClient),
distSQLScanConcurrency: distSQLScanConcurrency,
backoffWeight: backoffWeight,
client: client,
manager: newGCTTLManager(pdClient),
distSQLScanConcurrency: distSQLScanConcurrency,
backoffWeight: backoffWeight,
resourceGroupName: resourceGroupName,
explicitRequestSourceType: explicitRequestSourceType,

Check warning on line 289 in br/pkg/lightning/backend/local/checksum.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/lightning/backend/local/checksum.go#L284-L289

Added lines #L284 - L289 were not covered by tests
}
}

func (e *TiKVChecksumManager) checksumDB(ctx context.Context, tableInfo *checkpoints.TidbTableInfo, ts uint64) (*RemoteChecksum, error) {
executor, err := checksum.NewExecutorBuilder(tableInfo.Core, ts).
SetConcurrency(e.distSQLScanConcurrency).
SetBackoffWeight(e.backoffWeight).
SetResourceGroupName(e.resourceGroupName).
SetExplicitRequestSourceType(e.explicitRequestSourceType).
Build()
if err != nil {
return nil, errors.Trace(err)
Expand Down
4 changes: 3 additions & 1 deletion br/pkg/lightning/backend/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,11 @@
KeyspaceName string
// the scope when pause PD schedulers.
PausePDSchedulerScope config.PausePDSchedulerScope
ResourceGroupName string
}

// NewBackendConfig creates a new BackendConfig.
func NewBackendConfig(cfg *config.Config, maxOpenFiles int, keyspaceName string) BackendConfig {
func NewBackendConfig(cfg *config.Config, maxOpenFiles int, keyspaceName, resourceGroupName string) BackendConfig {

Check warning on line 428 in br/pkg/lightning/backend/local/local.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/lightning/backend/local/local.go#L428

Added line #L428 was not covered by tests
return BackendConfig{
PDAddr: cfg.TiDB.PdAddr,
LocalStoreDir: cfg.TikvImporter.SortedKVDir,
Expand All @@ -445,6 +446,7 @@
MaxOpenFiles: maxOpenFiles,
KeyspaceName: keyspaceName,
PausePDSchedulerScope: cfg.TikvImporter.PausePDSchedulerScope,
ResourceGroupName: resourceGroupName,

Check warning on line 449 in br/pkg/lightning/backend/local/local.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/lightning/backend/local/local.go#L449

Added line #L449 was not covered by tests
}
}

Expand Down
12 changes: 12 additions & 0 deletions br/pkg/lightning/backend/local/region_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ import (
"github.com/pingcap/tidb/br/pkg/lightning/metric"
"github.com/pingcap/tidb/br/pkg/logutil"
"github.com/pingcap/tidb/br/pkg/restore/split"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/util/codec"
"github.com/pingcap/tidb/util/mathutil"
"github.com/tikv/client-go/v2/util"
"go.uber.org/zap"
"google.golang.org/grpc"
)
Expand Down Expand Up @@ -230,6 +232,12 @@ func (local *Backend) writeToTiKV(ctx context.Context, j *regionJob) error {
Chunk: &sst.WriteRequest_Meta{
Meta: meta,
},
Context: &kvrpcpb.Context{
ResourceControlContext: &kvrpcpb.ResourceControlContext{
ResourceGroupName: local.ResourceGroupName,
},
RequestSource: util.BuildRequestSource(true, kv.InternalTxnLightning, util.ExplicitTypeLightning),
},
}
for _, peer := range region.GetPeers() {
cli, err := clientFactory.Create(ctx, peer.StoreId)
Expand Down Expand Up @@ -558,6 +566,10 @@ func (local *Backend) doIngest(ctx context.Context, j *regionJob) (*sst.IngestRe
RegionId: j.region.Region.GetId(),
RegionEpoch: j.region.Region.GetRegionEpoch(),
Peer: leader,
ResourceControlContext: &kvrpcpb.ResourceControlContext{
ResourceGroupName: local.ResourceGroupName,
},
RequestSource: util.BuildRequestSource(true, kv.InternalTxnLightning, util.ExplicitTypeLightning),
}

if supportMultiIngest {
Expand Down
12 changes: 12 additions & 0 deletions br/pkg/lightning/common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,11 @@
return strconv.Atoi(val)
}

// GetExplicitRequestSourceTypeFromDB gets the explicit request source type from database.
func GetExplicitRequestSourceTypeFromDB(ctx context.Context, db *sql.DB) (string, error) {
return getSessionVariable(ctx, db, variable.TiDBExplicitRequestSourceType)

Check warning on line 621 in br/pkg/lightning/common/util.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/lightning/common/util.go#L620-L621

Added lines #L620 - L621 were not covered by tests
}

// copy from dbutil to avoid import cycle
func getSessionVariable(ctx context.Context, db *sql.DB, variable string) (value string, err error) {
query := fmt.Sprintf("SHOW VARIABLES LIKE '%s'", variable)
Expand Down Expand Up @@ -648,3 +653,10 @@

return value, nil
}

// IsFunctionNotExistErr checks if err is a function not exist error.
func IsFunctionNotExistErr(err error, functionName string) bool {
return err != nil &&
(strings.Contains(err.Error(), "No database selected") ||
strings.Contains(err.Error(), fmt.Sprintf("%s does not exist", functionName)))

Check warning on line 661 in br/pkg/lightning/common/util.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/lightning/common/util.go#L658-L661

Added lines #L658 - L661 were not covered by tests
}
2 changes: 2 additions & 0 deletions br/pkg/lightning/importer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ go_library(
"//parser/model",
"//parser/mysql",
"//planner/core",
"//sessionctx/variable",
"//store/driver",
"//store/driver/txn",
"//store/pdtypes",
Expand Down Expand Up @@ -85,6 +86,7 @@ go_library(
"@com_github_pingcap_kvproto//pkg/metapb",
"@com_github_prometheus_client_golang//prometheus",
"@com_github_tikv_client_go_v2//config",
"@com_github_tikv_client_go_v2//util",
"@com_github_tikv_pd_client//:client",
"@io_etcd_go_etcd_client_v3//:client",
"@org_golang_google_grpc//:grpc",
Expand Down
8 changes: 7 additions & 1 deletion br/pkg/lightning/importer/checksum_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@
log.FromContext(ctx).Info("set tidb_backoff_weight to default", zap.Int("backoff_weight", local.DefaultBackoffWeight))
backoffWeight = local.DefaultBackoffWeight
}
manager = local.NewTiKVChecksumManager(store.GetClient(), pdCli, uint(rc.cfg.TiDB.DistSQLScanConcurrency), backoffWeight)

explicitRequestSourceType, err := common.GetExplicitRequestSourceTypeFromDB(ctx, rc.db)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it fail when the target cluster is lower version? Is this by design?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Querying a lower version of tidb only returns empty results.
  • When getting empty results, it will be the same as the default setting.

if err != nil {
log.FromContext(ctx).Warn("get tidb_request_source_type failed", zap.Error(err), zap.String("tidb_request_source_type", explicitRequestSourceType))
return nil, errors.Trace(err)
}
manager = local.NewTiKVChecksumManager(store.GetClient(), pdCli, uint(rc.cfg.TiDB.DistSQLScanConcurrency), backoffWeight, rc.resourceGroupName, explicitRequestSourceType)

Check warning on line 69 in br/pkg/lightning/importer/checksum_helper.go

View check run for this annotation

Codecov / codecov/patch

br/pkg/lightning/importer/checksum_helper.go#L64-L69

Added lines #L64 - L69 were not covered by tests
} else {
manager = local.NewTiDBChecksumExecutor(rc.db)
}
Expand Down
Loading
Loading