-
Notifications
You must be signed in to change notification settings - Fork 6k
ddl: support refresh meta ddl #60837
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
Changes from 12 commits
a4aa412
2b591ad
beb2ad6
f9a1cab
209ee26
37264a9
e7f869f
f8efafe
1f6545d
2350780
860e7d6
ee1bfdd
74e8530
7638778
b2a7b31
70507ff
04bbe0d
67263a7
ff5f58d
bfeca3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1699,3 +1699,25 @@ func onAlterNoCacheTable(jobCtx *jobContext, job *model.Job) (ver int64, err err | |
} | ||
return ver, err | ||
} | ||
|
||
func onRefreshMeta(jobCtx *jobContext, job *model.Job) (ver int64, err error) { | ||
_, err = model.GetRefreshMetaArgs(job) | ||
if err != nil { | ||
job.State = model.JobStateCancelled | ||
return 0, errors.Trace(err) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if underlying table is removed by BR, can we update that to info schema as well. Right now it's assuming underlying TiKV also contain the specified table meta KV. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
now skip table validate in ddl |
||
// update schema version | ||
ver, err = updateSchemaVersion(jobCtx, job) | ||
if err != nil { | ||
return ver, errors.Trace(err) | ||
} | ||
|
||
var tbInfo *model.TableInfo | ||
metaMut := jobCtx.metaMut | ||
tbInfo, err = GetTableInfoAndCancelFaultJob(metaMut, job, job.SchemaID) | ||
if err != nil { | ||
return ver, err | ||
} | ||
job.FinishTableJob(model.JobStateDone, model.StatePublic, ver, tbInfo) | ||
return ver, nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1785,3 +1785,22 @@ func GetFinishedModifyColumnArgs(job *Job) (*ModifyColumnArgs, error) { | |
} | ||
return getOrDecodeArgsV2[*ModifyColumnArgs](job) | ||
} | ||
|
||
// RefreshMetaArgs is the argument for RefreshMeta. | ||
type RefreshMetaArgs struct { | ||
SchemaID int64 `json:"schema_id,omitempty"` | ||
TableID int64 `json:"table_id,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will it be faster if we can specify batch table IDs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, but now for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Get |
||
} | ||
|
||
func (a *RefreshMetaArgs) getArgsV1(*Job) []any { | ||
return []any{a} | ||
} | ||
|
||
func (a *RefreshMetaArgs) decodeV1(job *Job) error { | ||
return errors.Trace(job.decodeArgs(a)) | ||
} | ||
|
||
// GetRefreshMetaArgs get the refresh meta argument. | ||
func GetRefreshMetaArgs(job *Job) (*RefreshMetaArgs, error) { | ||
return getOrDecodeArgs[*RefreshMetaArgs](&RefreshMetaArgs{}, job) | ||
} |
Uh oh!
There was an error while loading. Please reload this page.
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.
could we add check here or at
RefreshMeta
to verify that the info schema doesn't have tableInfo with same table id or name as the job specified but without restoreMode? so to be safe that refresh doesn't override anything unexpected.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.
maybe we can skip refresh when tableinfo is exist in info schema and the tablemode isn't restoreMode?