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 parallel import cause region count grows #58786

Open
lance6716 opened this issue Jan 8, 2025 · 1 comment
Open

lightning parallel import cause region count grows #58786

lance6716 opened this issue Jan 8, 2025 · 1 comment
Assignees
Labels
severity/moderate type/bug The issue is confirmed as a bug.

Comments

@lance6716
Copy link
Contributor

lance6716 commented Jan 8, 2025

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

use multiple lightning node to import

2. What did you expect to see? (Required)

the region count should be almost the same as there's only one lightning node

3. What did you see instead (Required)

the region count is #lightning times than the single lightning import

4. What is your TiDB version? (Required)

because lightning will call PD SetRegionLabelRule, and this API will split region on the request key range. And lightning uses actual data range as the key range. When there're multiple lightning node, each node has different key range. So each node will causes region split once

if len(splitKeys) > 0 && local.PausePDSchedulerScope == config.PausePDSchedulerScopeTable {
log.FromContext(ctx).Info("pause pd scheduler of table scope")
subCtx, cancel := context.WithCancel(ctx)
defer cancel()
var startKey, endKey []byte
if len(splitKeys[0]) > 0 {
startKey = codec.EncodeBytes(nil, splitKeys[0])
}
if len(splitKeys[len(splitKeys)-1]) > 0 {
endKey = codec.EncodeBytes(nil, splitKeys[len(splitKeys)-1])
}
done, err := pdutil.PauseSchedulersByKeyRange(subCtx, local.pdHTTPCli, startKey, endKey)

maybe consider to use the whole range of tableID, or tableID + record/ indexID in the request

@lance6716 lance6716 added type/bug The issue is confirmed as a bug. severity/moderate labels Jan 8, 2025
@OliverS929
Copy link
Contributor

/assign OliverS929

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants