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

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

Closed
Tracked by #18030
lcwangchao opened this issue Dec 6, 2021 · 1 comment · Fixed by #30705
Closed
Tracked by #18030

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

lcwangchao opened this issue Dec 6, 2021 · 1 comment · Fixed by #30705

Comments

@lcwangchao
Copy link
Collaborator

lcwangchao commented Dec 6, 2021

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.
@morgo
Copy link
Contributor

morgo commented Dec 6, 2021

I like option (1).

i.e. In the case of drop table t; drop placement policy p1; create placement policy p1 ..; recover table t I do not think it is correct to refer to the original policy p1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants