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

ddl: postpone cleaning placement rules to gc-worker #28687

Merged

Conversation

AilinKid
Copy link
Contributor

@AilinKid AilinKid commented Oct 9, 2021

What problem does this PR solve?

Issue Number: close #28686

Problem Summary:

What is changed and how it works?

What's Changed:
1: remove the instant notification of cleaning placement rules when dropping table in the ddl workers.
2: make gc worker clean all the placement rules for both table and partitions (since it's idempotent, doing it for every partition range is ok)

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
Test
case 1: non-partition table
tiup playground v5.0.1 --tiflash 0  --kv 2 --db 1
create table t(a int) constraints="[-region=hdd]"
drop table t
http://127.0.0.1:2379/pd/api/v1/config/placement-rule     // check placement rules for table t is cleaned after gc_life_time

case 1: partition table
create table t2(a int) constraints="[-region=ssd]" partition by range(a) (PARTITION p0 VALUES LESS THAN (100) constraints="[-region=hdd]");
drop table t
http://127.0.0.1:2379/pd/api/v1/config/placement-rule     // check placement rules for table t2 is cleaned after gc_life_time

Release note

None

Signed-off-by: ailinkid <314806019@qq.com>
Signed-off-by: ailinkid <314806019@qq.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Oct 9, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • djshow832
  • xhebox

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 9, 2021
@sre-bot
Copy link
Contributor

sre-bot commented Oct 9, 2021

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what is changed

Or if the count of mainly changed packages are more than 3, use

  • *: what is changed

After you have format title, you can leave a comment /run-check_title to recheck it

@AilinKid AilinKid changed the title Fix drop table cannot drop placement rules ddl: postpone cleaning placement rules to gc-worker Oct 9, 2021
@AilinKid
Copy link
Contributor Author

AilinKid commented Oct 9, 2021

/run-check_dev_2

@@ -339,12 +333,6 @@ func onDropTableOrView(d *ddlCtx, t *meta.Meta, job *model.Job) (ver int64, _ er
break
}
}
// Clean the placement bundle to PD.
err = dropRuleBundles(d, physicalTableIDs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add some comments here about why we not drop rule bundles here and postpone it to gc_worker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added:
Placement rules cannot be removed immediately after drop table / truncate table, because the tables can be flashed back or recovered.

@xhebox xhebox self-requested a review October 11, 2021 07:13
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 12, 2021
@lcwangchao
Copy link
Collaborator

LGTM. but I'm not very familiar with gc_worker. May be you can ask another one to review it again? @AilinKid

@AilinKid
Copy link
Contributor Author

LGTM. but I'm not very familiar with gc_worker. May be you can ask another one to review it again? @AilinKid

@djshow832

@xhebox xhebox requested a review from djshow832 October 13, 2021 04:19
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 14, 2021
@djshow832
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: b48dc9f

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Oct 14, 2021
@ti-chi-bot
Copy link
Member

@AilinKid: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ddl: drop table should clean the placement bundle rules
6 participants