-
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: fix reassigned partition id in truncate table
does not take effect
#7919
Changes from 3 commits
45bf86b
2fa6b5d
09b6b23
ff5da6b
50de52c
63c4cd0
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 |
---|---|---|
|
@@ -417,3 +417,16 @@ func isRangePartitionColUnsignedBigint(cols []*table.Column, pi *model.Partition | |
} | ||
return false | ||
} | ||
|
||
// truncateTableFromReassignPartitionIDs reassign a new partition ids. | ||
func truncateTableFromReassignPartitionIDs(job *model.Job, t *meta.Meta, tblInfo *model.TableInfo) error { | ||
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.
|
||
for i := range tblInfo.Partition.Definitions { | ||
pid, err := t.GenGlobalID() | ||
if err != nil { | ||
job.State = model.JobStateCancelled | ||
return errors.Trace(err) | ||
} | ||
tblInfo.Partition.Definitions[i].ID = pid | ||
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. So, if an error occur and DDL rollback, 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. @tiancaiamao This is executed in a transaction. All changes will not take effect until the transaction is successfully committed. 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. @tiancaiamao |
||
} | ||
return nil | ||
} |
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.
truncateTableFromReassignPartitionIDs
--->truncateTableByReassignPartitionIDs