-
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
statistics: handle exchange partition event #49043
statistics: handle exchange partition event #49043
Conversation
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.
🔢 Self-check
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #49043 +/- ##
================================================
+ Coverage 71.0418% 72.0011% +0.9592%
================================================
Files 1368 1407 +39
Lines 402868 414727 +11859
================================================
+ Hits 286205 298608 +12403
- Misses 96722 97275 +553
+ Partials 19941 18844 -1097
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
🔢 Self-check
/retest |
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.
🔢 Self-check
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.
🔢 Self-check
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.
🔢 Self-check
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
Signed-off-by: hi-rustin <[email protected]>
ad90dd2
to
2f6c2c3
Compare
// updateStatsWithCountDeltaAndModifyCountDelta updates | ||
// the global stats with the given count delta and modify count delta. | ||
// Only used by some special DDLs, such as exchange partition. | ||
func updateStatsWithCountDeltaAndModifyCountDelta( |
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.
TiDB supports changing multiple schemas in ALTER TABLE. so it can exchange table partitions for multi-table. Do you need it to support batch update/insert here?
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.
You cannot exchange more than one partition in TiDB. Therefore, it's okay. "Even if you exchange them together, they are still considered as different events."
@@ -2594,6 +2594,9 @@ func (w *worker) onExchangeTablePartition(d *ddlCtx, t *meta.Meta, job *model.Jo | |||
|
|||
// exchange table meta id | |||
pt.ExchangePartitionInfo = nil | |||
// Used below to update the partitioned table's stats meta. | |||
originalPartitionDef := partDef.Clone() | |||
originalNt := nt.Clone() | |||
partDef.ID, nt.ID = nt.ID, partDef.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.
cc: @hawkingrei As you can see, we only exchange one partition here.
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.
🔢 Self-check
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: time-and-fate, 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 |
[LGTM Timeline notifier]Timeline:
|
What problem does this PR solve?
Issue Number: close #47354
Problem Summary:
What changed and how does it work?
Based on this design doc, we will only update the count and modfiy_count for it. Then it will use the count and modify_count to determine if we need to trigger an auto-analysis task.
So in this PR, I updated the global stats with the old partition info and table info.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.