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

Altering placement rules when truncating a table #18208

Closed
Tracked by #18030
djshow832 opened this issue Jun 24, 2020 · 1 comment
Closed
Tracked by #18030

Altering placement rules when truncating a table #18208

djshow832 opened this issue Jun 24, 2020 · 1 comment
Labels
sig/sql-infra SIG: SQL Infra type/enhancement The issue or PR belongs to an enhancement. type/usability

Comments

@djshow832
Copy link
Contributor

Development Task

Background

It's a part of project "Placement rules in SQL". It should accomplished after adding placement rules (#18200).

When truncating a table, the table id is changed, so the placement rules on it should also be altered. But it's not straightforward: the table might be recovered later, through FLASHBACK or RECOVER statements. Once it's recovered, the placement rules on the old table should also be recovered, which is not necessarily the same with the new one, as the placement rules on the new one may be changed. So the placement rules can't be altered immediately.

Solutions

As dropping tables, the most straightforward solution is to create a goroutine to check the table periodically. Once the table can't be recovered, notify PD to drop its old placement rules. Once the table is recovered, recover the old placement rules.

But note that TiDB may shutdown anytime, so the information should be persisted in TiKV and the goroutine should be always running.

@morgo
Copy link
Contributor

morgo commented Jul 29, 2021

This should have been fixed by #20622. We can reopen if that's not the case.

@morgo morgo closed this as completed Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra type/enhancement The issue or PR belongs to an enhancement. type/usability
Projects
None yet
Development

No branches or pull requests

3 participants