tidb icon indicating copy to clipboard operation
tidb copied to clipboard

*: let planner decide the col refs for non-partition and non-foreignkey table's delete

Open winoros opened this issue 1 year ago • 4 comments

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

winoros avatar Jun 17 '24 17:06 winoros

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:

codecov[bot] avatar Jun 17 '24 18:06 codecov[bot]

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.

winoros avatar Jun 18 '24 17:06 winoros

Multi-table delete's change will be added soon.

winoros avatar Jun 19 '24 01:06 winoros

QQ_1720456173242 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.

winoros avatar Jul 08 '24 16:07 winoros

/retest

winoros avatar Jul 08 '24 17:07 winoros

/retest

winoros avatar Jul 08 '24 18:07 winoros

//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.

winoros avatar Jul 15 '24 02:07 winoros

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.

ti-chi-bot[bot] avatar Jul 18 '24 06:07 ti-chi-bot[bot]

/retest

winoros avatar Jul 29 '24 18:07 winoros

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.

ti-chi-bot[bot] avatar Aug 10 '24 09:08 ti-chi-bot[bot]

[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.

ti-chi-bot[bot] avatar Sep 12 '24 09:09 ti-chi-bot[bot]

[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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

ti-chi-bot[bot] avatar Sep 13 '24 12:09 ti-chi-bot[bot]

@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.

tiprow[bot] avatar Sep 13 '24 12:09 tiprow[bot]

/unhold

winoros avatar Sep 13 '24 12:09 winoros