Skip to content

Handle incompatible meta when recovering a table referring a policy #30417

Closed
@lcwangchao

Description

We should handle the below scene:

create policy p1 primary_region='r1' regions='r1,r2';
create table t (id int) placement policy p1;
drop table t;
drop table p1;
-- or create a new policy with a same name p1 here

recover table t; 
show create table t; -- should t still referring a policy p1 ?

Maybe there are two solutions:

  1. recover all table's placement as direct options. For example, show create table t will return the result as:
CREATE TABLE `t1` (
  `id` int(11) DEFAULT NULL
)  /*T![placement] PRIMARY_REGION="r1" REGIONS="r1,r2" */ 
  1. Fails if meta not match. It will check if the policy with the same ID exists when recovering, if not, it fails. Notice that we can set sys variable placement_checks to false to skip checking. At this time if the policy p1 does not exists (or with a different id) , it will recover a table without any placement settings.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions