*: let planner decide the col refs for non-partition and non-foreignkey table's delete
What problem does this PR solve?
Issue Number: ref https://github.com/pingcap/tidb/issues/38911
Problem Summary:
What changed and how does it work?
This pull tries to change the column references of rows to be deleted to the ones constructed by planner. Make it possible to prune columns for deletion.
Check List
Tests
- [x] Unit test
- [x] Integration test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test
- [ ] I checked and no code files have been changed.
Side effects
- [ ] Performance regression: Consumes more CPU
- [ ] Performance regression: Consumes more Memory
- [ ] Breaking backward compatibility
Documentation
- [ ] Affects user behaviors
- [ ] Contains syntax changes
- [ ] Contains variable changes
- [ ] Contains experimental features
- [ ] Changes MySQL compatibility
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
None
Codecov Report
Attention: Patch coverage is 81.28342% with 35 lines in your changes missing coverage. Please review.
Project coverage is 58.0243%. Comparing base (
08bebab) to head (eef50c4). Report is 23 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #54065 +/- ##
=================================================
- Coverage 72.9131% 58.0243% -14.8889%
=================================================
Files 1604 1802 +198
Lines 446718 682340 +235622
=================================================
+ Hits 325716 395923 +70207
- Misses 100942 259977 +159035
- Partials 20060 26440 +6380
| Flag | Coverage Δ | |
|---|---|---|
| integration | 39.4795% <82.5000%> (?) |
|
| unit | 71.9866% <83.7500%> (-0.0364%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Components | Coverage Δ | |
|---|---|---|
| dumpling | 52.9567% <ø> (ø) |
|
| parser | ∅ <ø> (∅) |
|
| br | 61.0209% <ø> (+15.2901%) |
:arrow_up: |
I want this pull to get at least three LGTM.
So add the hold label to make sure that it would not be merged accidentally.
Multi-table delete's change will be added soon.
FK is checked before the
recordSet.Close() is called. I think it's a very reasonable behavior. So the single table delete case also needs to set and reset the extra info for each row.
/retest
/retest
//go:noinline
func doNoDefer(t *int) {
*t++
*t++
}
//go:noinline
func doDefer(t *int) {
defer func() {
*t++
}()
*t++
}
func BenchmarkDeferYes(b *testing.B) {
t := 0
for i := 0; i < b.N; i++ {
doDefer(&t)
}
}
func BenchmarkDeferNo(b *testing.B) {
t := 0
for i := 0; i < b.N; i++ {
doNoDefer(&t)
}
}
goos: linux
goarch: amd64
pkg: github.com/pingcap/tidb/pkg/planner/core
cpu: Intel(R) Xeon(R) Gold 6240 CPU @ 2.60GHz
BenchmarkDeferYes
BenchmarkDeferYes-72 255241609 4.967 ns/op 0 B/op 0 allocs/op
BenchmarkDeferNo
BenchmarkDeferNo-72 729406417 1.646 ns/op 0 B/op 0 allocs/op
PASS
The performance has improved a lot. I think it's ok to use defer in this pull.
PR needs rebase.
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.
/retest
PR needs rebase.
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.
[LGTM Timeline notifier]
Timeline:
2024-09-09 16:42:10.362849391 +0000 UTC m=+288200.103273395: :ballot_box_with_check: agreed by crazycs520.2024-09-12 09:29:06.291259656 +0000 UTC m=+521416.031683594: :ballot_box_with_check: agreed by lcwangchao.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: cfzjywxk, crazycs520, lcwangchao, tangenta, time-and-fate
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [cfzjywxk,crazycs520,lcwangchao,tangenta,time-and-fate]
- ~~pkg/infoschema/OWNERS~~ [tangenta]
- ~~pkg/planner/OWNERS~~ [time-and-fate]
- ~~pkg/table/OWNERS~~ [cfzjywxk,tangenta]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
@winoros: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:
| Test name | Commit | Details | Required | Rerun command |
|---|---|---|---|---|
| fast_test_tiprow | eef50c4aeae24e468e72493480edf4d9f9485622 | link | true | /test fast_test_tiprow |
Full PR test history. Your PR dashboard.
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-sigs/prow repository. I understand the commands that are listed here.
/unhold