-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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 xx cache
operations
#29022
Conversation
… into samllhottable-parser
… into samllhottable-parser
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
alter table xx cache
operationsalter table xx cache
operations
alter table xx cache
operationsalter table xx cache
operations
./rebuild |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
./rebuild |
@@ -6587,3 +6589,20 @@ func (d *ddl) AlterPlacementPolicy(ctx sessionctx.Context, stmt *ast.AlterPlacem | |||
err = d.callHookOnChanged(err) | |||
return errors.Trace(err) | |||
} | |||
func (d *ddl) AlterTableCache(ctx sessionctx.Context, ti ast.Ident) (err error) { | |||
schema, t, err := d.getSchemaAndTableByIdent(ctx, ti) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if it is already cached. If it is, we don't even need to add a job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is checking the type of the table (is it a view) one of the feature compatibilities you mentioned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i check if is a already cached in onAlterTableCache function. if needed i can change its position
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically, we check it twice. One before creating the job and another in executing the job.
Also, please notice the other question I asked above.
ddl/ddl_api.go
Outdated
SchemaID: schema.ID, | ||
TableID: t.Meta().ID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about SchemaName
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...i not use it. so i am not transfer it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use it in some places, such as error reporting and show DDL jobs. It's better to follow the convention.
@djshow832 please PTAL again |
./rebuild |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: f44f76d
|
close #29085 |
What problem does this PR solve?
handle DDL schema changes when a table is set to cachable , we use synatx
alter table xx cache
to switch a table to cachableProblem Summary: See Optimizing hotspot small tables #25293
What is changed and how it works?
support switch a table to cachable operation. and do some compatibility check with other feature.
ALTER TABLE t CACHE
is a DDL operation. for consistency under distributed conditions. an intermediateSwitching
state is introduced, the schema change process is similar to the table lock implementation:Disabled => Switching => Enabled
work
Check List
Tests
Release note