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

Duplicate call GetRegionByID in checkPartitionReplica #58602

Closed
okJiang opened this issue Dec 30, 2024 · 0 comments · Fixed by #58603
Closed

Duplicate call GetRegionByID in checkPartitionReplica #58602

okJiang opened this issue Dec 30, 2024 · 0 comments · Fixed by #58603
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@okJiang
Copy link
Member

okJiang commented Dec 30, 2024

Enhancement

As title, it is unnecessary. The return of GetRegionByID is same as ScanRegions

tidb/pkg/ddl/partition.go

Lines 440 to 451 in cdcc291

startKey, endKey := tablecodec.GetTableHandleKeyRange(pDef.ID)
regions, err := pdCli.BatchScanRegions(ctx, []router.KeyRange{{StartKey: startKey, EndKey: endKey}}, -1)
if err != nil {
return needWait, errors.Trace(err)
}
// For every region in the partition, if it has some corresponding peers and
// no pending peers, that means the replication has completed.
for _, region := range regions {
regionState, err := pdCli.GetRegionByID(ctx, region.Meta.Id)
if err != nil {
return needWait, errors.Trace(err)
}

@okJiang okJiang added the type/enhancement The issue or PR belongs to an enhancement. label Dec 30, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in 70393b5 Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant