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

Delete TiFlash placement rules in gc worker may take a long time #54068

Closed
Lloyd-Pottiger opened this issue Jun 18, 2024 · 1 comment · Fixed by #54071
Closed

Delete TiFlash placement rules in gc worker may take a long time #54068

Lloyd-Pottiger opened this issue Jun 18, 2024 · 1 comment · Fixed by #54071
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. component/tiflash type/enhancement The issue or PR belongs to an enhancement.

Comments

@Lloyd-Pottiger
Copy link
Contributor

Enhancement

Now in gc worker, we delete placement rules of TiFlash one by one. It may takes a long time when drop database or drop table with a lot of partitions. We can easily optimize it by batch delete.

for _, id := range physicalTableIDs {
// Delete pd rule
failpoint.Inject("gcDeletePlacementRuleCounter", func() {})
logutil.BgLogger().Info("try delete TiFlash pd rule",
zap.Int64("tableID", id), zap.String("endKey", string(dr.EndKey)), zap.Uint64("safePoint", safePoint))
ruleID := infosync.MakeRuleID(id)
if err := infosync.DeleteTiFlashPlacementRule(context.Background(), "tiflash", ruleID); err != nil {
logutil.BgLogger().Error("delete TiFlash pd rule failed when gc",
zap.Error(err), zap.String("ruleID", ruleID), zap.Uint64("safePoint", safePoint))
}
}

@Lloyd-Pottiger Lloyd-Pottiger added the type/enhancement The issue or PR belongs to an enhancement. label Jun 18, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in d1f2671 Jun 19, 2024
@JaySon-Huang
Copy link
Contributor

Consider backport this to release-6.5/7.1/7.5/8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. component/tiflash type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants