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

Do not report error for placement rules that has an non-exist partition ID #22950

Closed
xhebox opened this issue Feb 25, 2021 · 1 comment · Fixed by #22951
Closed

Do not report error for placement rules that has an non-exist partition ID #22950

xhebox opened this issue Feb 25, 2021 · 1 comment · Fixed by #22951
Assignees
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@xhebox
Copy link
Contributor

xhebox commented Feb 25, 2021

Development Task

It is a known issue. Placement rules are cached in memory, persisted in PD. drop table should drop placement rules attached to the table. But you may recover the table later and expect that placement rules will recover, too.

We solve that by delaying the deletion of placement rules, check #20575. But as we don't really drop the persisted rules in PD. TiDB will reload the deleted rules back when:

  1. restart
  2. DDL infoschema fullLoad/snapshot load

Then you met the error mysql root@127.0.0.1:(none)> select * from information_schema.placement_policy (1105, "Can't find partition by id 59")

The full reproduce instructions

# start TiUP and add some rules

mysql root@127.0.0.1:(none)> select * from information_schema.placement_policy
+-------------+-------------+---------+-------------+------------+----------------+------------+--------+----------+-------------------+
| GROUP_ID    | GROUP_INDEX | RULE_ID | SCHEMA_NAME | TABLE_NAME | PARTITION_NAME | INDEX_NAME | ROLE   | REPLICAS | CONSTRAINTS       |
+-------------+-------------+---------+-------------+------------+----------------+------------+--------+----------+-------------------+
| TiDB_DDL_59 | 3           | leader  | test        | t          | p0             | <null>     | leader | 1        | "-engine=tiflash" |
| TiDB_DDL_59 | 3           | voter   | test        | t          | p0             | <null>     | voter  | 3        | "-engine=tiflash" |
+-------------+-------------+---------+-------------+------------+----------------+------------+--------+----------+-------------------+
mysql root@127.0.0.1:(none)> drop table test.t
mysql root@127.0.0.1:(none)> select * from information_schema.placement_policy
+----------+-------------+---------+-------------+------------+----------------+------------+------+----------+-------------+
| GROUP_ID | GROUP_INDEX | RULE_ID | SCHEMA_NAME | TABLE_NAME | PARTITION_NAME | INDEX_NAME | ROLE | REPLICAS | CONSTRAINTS |
+----------+-------------+---------+-------------+------------+----------------+------------+------+----------+-------------+

# restart(scale-in + scale-out) the TiDB node

mysql root@127.0.0.1:(none)> select * from information_schema.placement_policy
(1105, "Can't find partition by id 59")
@xhebox xhebox added the type/enhancement The issue or PR belongs to an enhancement. label Feb 25, 2021
@xhebox
Copy link
Contributor Author

xhebox commented Feb 25, 2021

/assign

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