Altering placement rules when truncating a table #18208
Labels
sig/sql-infra
SIG: SQL Infra
type/enhancement
The issue or PR belongs to an enhancement.
type/usability
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
orRECOVER
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.
The text was updated successfully, but these errors were encountered: