-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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: set jobs dependency by schema and table name #49699
Conversation
Hi @tangenta. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. 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 kubernetes/test-infra repository. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #49699 +/- ##
================================================
+ Coverage 70.9732% 71.4517% +0.4784%
================================================
Files 1368 1429 +61
Lines 398095 421637 +23542
================================================
+ Hits 282541 301267 +18726
- Misses 95813 101425 +5612
+ Partials 19741 18945 -796
Flags with carried forward coverage won't be shown. Click here to find out more.
|
pkg/ddl/ddl_api.go
Outdated
@@ -6898,6 +6924,9 @@ func (d *ddl) renameTables(ctx sessionctx.Context, oldIdents, newIdents []ast.Id | |||
BinlogInfo: &model.HistoryInfo{}, | |||
Args: []interface{}{oldSchemaIDs, newSchemaIDs, tableNames, tableIDs, oldSchemaNames, oldTableNames}, | |||
CtxVars: []interface{}{append(oldSchemaIDs, newSchemaIDs...), tableIDs}, | |||
|
|||
AffectedSchemaNames: affectedSchemaNames, | |||
AffectedTableNames: affectedTableNames, |
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 put these fields to MultiSchemaInfo
?
There seems to be some overlap between TableName
and AffectedTableNames
.
But in that case, the rename table
operation is a little tricky to explain. Or we can specially handle this operation by getting the RawArgs
information.
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.
No, MultiSchemaInfo
is only used for multi-schema changes, and this PR is not related to multi-schema changes.
rename table
may change RawArgs
during execution, with increasing complexity.
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.
Or consider putting some related fields into a field of this 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.
Could we use AffectedSchemaNames
to update job2SchemaNames
?
#43818
} | ||
create1TS, dropTS, create0TS := finishTSs[0], finishTSs[1], finishTSs[2] | ||
require.Less(t, create0TS, dropTS, "first create should finish before drop") | ||
require.Less(t, dropTS, create1TS, "second create should finish after drop") |
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.
Test failed:
ddl_api_test.go:214:
Error Trace: pkg/ddl/ddl_api_test.go:214
Error: "446560642158297088" is not less than "446560641896677376"
Test: TestCreateDropCreateTable
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.
The failpoint mockOwnerCheckAllVersionSlow
does not work in time. I have changed the sleep time from 1 second to 2 seconds.
pkg/ddl/ddl_running_jobs.go
Outdated
|
||
type runningJobs struct { | ||
sync.RWMutex | ||
ids map[int64][]model.InvolvingSchemaInfo |
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 another map(as revert index) using schema+tablen as the key and the "jobid1, jobid2" string as a value to make check conflict more efficient?
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.
OK.
pkg/ddl/ddl_api.go
Outdated
@@ -6898,6 +6934,8 @@ func (d *ddl) renameTables(ctx sessionctx.Context, oldIdents, newIdents []ast.Id | |||
BinlogInfo: &model.HistoryInfo{}, | |||
Args: []interface{}{oldSchemaIDs, newSchemaIDs, tableNames, tableIDs, oldSchemaNames, oldTableNames}, | |||
CtxVars: []interface{}{append(oldSchemaIDs, newSchemaIDs...), tableIDs}, | |||
|
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.
@@ -5044,6 +5066,10 @@ func (d *ddl) ExchangeTablePartition(ctx sessionctx.Context, ident ast.Ident, sp | |||
BinlogInfo: &model.HistoryInfo{}, | |||
Args: []interface{}{defID, ptSchema.ID, ptMeta.ID, partName, spec.WithValidation}, | |||
CtxVars: []interface{}{[]int64{ntSchema.ID, ptSchema.ID}, []int64{ntMeta.ID, ptMeta.ID}}, | |||
InvolvingSchemaInfo: []model.InvolvingSchemaInfo{ |
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 saw you have added one blank line since 6937, please make it all consistent.
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.
LGTM
[LGTM Timeline notifier]Timeline:
|
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.
parser part lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Benjamin2037, D3Hunter, zimulala The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
/cherry-pick release-6.5-20231229-v6.5.6 |
@okJiang: new pull request created to branch In response to this:
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. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: close #49498
Problem Summary:
We should also consider schema & table name before picking a DDL job to execute.
What changed and how does it work?
ddl.runningJobs
to a separate file.AffectedSchemaNames
andAffectedTableNames
tomodel.Job
.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.