-
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
*: Reorg partition fix delete ranges and handling non-clustered tables with concurrent DML (#57114) #58124
*: Reorg partition fix delete ranges and handling non-clustered tables with concurrent DML (#57114) #58124
Conversation
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Copilot
AI
left a comment
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.
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 suggestion.
Files not reviewed (1)
- pkg/ddl/tests/partition/BUILD.bazel: Language not supported
Comments skipped due to low confidence (1)
pkg/table/tables/partition.go:1632
- [nitpick] The variable name 'recordID' is ambiguous in this context. It should be renamed to 'partitionRecordID' to avoid confusion.
tbl = t.GetPartition(pid)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-7.5 #58124 +/- ##
================================================
Coverage ? 72.1470%
================================================
Files ? 1416
Lines ? 413292
Branches ? 0
================================================
Hits ? 298178
Misses ? 95110
Partials ? 20004
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest |
if prr.warning != nil { | ||
if _, ok := warningsCountMap[prr.warning.ID()]; ok { | ||
warningsCountMap[prr.warning.ID()]++ | ||
} else { | ||
warningsCountMap[prr.warning.ID()] = 1 | ||
warningsMap[prr.warning.ID()] = prr.warning | ||
} | ||
} |
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.
warnings were never set, and cannot happen, since we are copying data without any conversions.
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bb7133, mjonss, tangenta 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 |
/retest |
This is an automated cherry-pick of #57114
What problem does this PR solve?
Issue Number: close #56822 ref #45133 close #57510
based on #56974.
Problem Summary:
First the DeleteRange did not include the old replaced Global Indexes,
Then I found an issue with non-clustered tables and reorganize partition,
where double written records during StateWriteOnly/StateWriteReorganization would get Duplicate key errors, due to they would generate new _tidb_rowid in the new partition, making it impossible to detect if an index entry came from Backfilling or if it is new, when recreating the indexes.
What changed and how does it work?
Fixed the DeleteRange, by adding a list of TableID+IndexID ranges that should also be cleaned by DeleteRanges.
Instead of first copy all records and then recreate the indexes, I now use AddRecord table interface, and created both the table record as well as all the index entries for that row. Note that AddRecord will also generate a new _tidb_rowid, so that part of the reorg code is removed as well.
Drawbacks are:
Benefits are:
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.