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: support alter table add/drop/alter check constraint #10

Closed
wants to merge 1 commit into from

Conversation

AilinKid
Copy link

@AilinKid AilinKid commented Jun 4, 2020

Signed-off-by: AilinKid 314806019@qq.com

What problem does this PR solve?

support alter table with constraint ddl action.

create table t(a int);

**Add constraint**:
alter table t add constraint haha check(a >1);

> Attention: check constraint will fetch the data from table to check.

**Alter constraint**:
alter table t alter constraint haha enforced;

> Attention: not enforced check constraint will allow the violated data to insert, but when change a constraint from not enforced to enforced, it will fetch the data to check constraint.

**Drop constraint**:
alter table t drop constraint haha;

What is changed and how it works?

Schema State: None -> Write Only -> Public
None: Node in this state will not perceive the constraint existence, and the inserted data may violate the check constraint.

Write Only: Node in this state will actually see check constraint existence, but the inserted data will check the constraint rule. If broken, ddl fails.

Public: on the way from Write Only to Public, ddl owner will fetch the old data previous to Write Only state, and check the data whether it's satisfied the check constraint rule. If broken, ddl fails.

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has interface methods change

Release note

  • Write release note for bug-fix or new feature.
  • ddl: support alter table add/drop/alter check constraint

Signed-off-by: AilinKid <314806019@qq.com>
@imtbkcat
Copy link
Collaborator

@AilinKid please fix conflict

@AilinKid
Copy link
Author

Migrated to the new pr #12 in which I add more cancel test about alter constraint.

@AilinKid AilinKid closed this Jun 12, 2020
crazycs520 pushed a commit that referenced this pull request Aug 11, 2020
…p#17232)

* support batch cop for tiflash

* support batch cop

* support join push down to tiflash

* refine

* change pb

* push join

* fix

* add hint

* refine hint

* add ranges

* fix

* fix

* fix push down

* fix index

* enable distsql for join

* add a session var to disable/enable broadcast join

* fix bug

* fix bug

* tiny fix

* enable cast decimal pushdown to tiflash

* fix

* fix bc join bug

* make broadcast plan stable

* refine code

* fix bug

* basic support for multi table broadcast join

* fix bug

* basic cbo for broadcast join

* improve

* fix bug

* remote useless code

* add tests

* pass unit tests

* refine code

* support execute summary info for broadcast join

* fix bug in explain for broadcast join

* format code

* remove un-needed code

* fix make dev

* address comments

* Hanfei/join merge (#7)

* enable exec details for batch cop

* format code

* fix test

* change tidb_opt_broadcast_join to global vars

* Ban cartesian join to be pushed down to TiFlash (#8)

* merge master (#10)

* merge master

* fix bug

* fix bug

* fix ut

* check session var conflict

* Add perfer local hint for broadcast join (#12)

* update

* remove useless code

* remove useless code

* update parser

* add test for prefer local join

* use bcj_local

* update go.mod

* refine planner

* refine comments

* fix make dev

* fix make dev

* update parser

* address comments

* fix make dev

* disable broadcast join when new collation is enabled

* Update planner/core/exhaust_physical_plans.go

Co-authored-by: Zhuomin(Charming) Liu <lzmhhh123@gmail.com>

* address comments

* fix

* address comments

* fix tests

* address comments

Co-authored-by: xufei <xufeixw@mail.ustc.edu.cn>
Co-authored-by: xufei <xufei@pingcap.com>
Co-authored-by: 虎 <ichneumon.hu@foxmail.com>
Co-authored-by: Zhuomin(Charming) Liu <lzmhhh123@gmail.com>
bb7133 pushed a commit that referenced this pull request Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants