Skip to content
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

*: fix cte nil pointer error when got multiple apply #44782

Merged
merged 19 commits into from
Jun 20, 2023

Conversation

guo-shaoge
Copy link
Collaborator

@guo-shaoge guo-shaoge commented Jun 19, 2023

What problem does this PR solve?

Issue Number: close #44774

Problem Summary:
The following plan:

Apply-1
    outerSide
    Apply-2
        CTE-1(access CTEProducer-1)
        CTE-2(access CTEProducer-1)

CTEProducer-1 has corCol, which is one of columns of Apply-1's outerSide output)

If CTE-1 and CTE-2 both access the same CTE Producer(a.k.a. same CTE defition), we use CTEExec.IsInApply to control whether reopen CTEStorage.

But CTE.IsInApply is not enough here, because CTE-1 and CTE-2 only need to reopen when Apply-1 runs, no need to reopen when Apply-2 runs.

What is changed and how it works?

Before: Always reopen CTEStorage/CTEProducer when CTE.IsInApply is true.

After: Only reopen CTEStorage/CTEProducer when the data of corCol changes.

Check List

Tests

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

Signed-off-by: guo-shaoge <shaoge1994@163.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. and removed do-not-merge/needs-triage-completed labels Jun 19, 2023
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
@guo-shaoge guo-shaoge changed the title *: fix cte when got multiple apply *: fix cte nil pointer error when got multiple apply Jun 19, 2023
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
@guo-shaoge
Copy link
Collaborator Author

/test check_dev2

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 19, 2023

@guo-shaoge: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test build
  • /test canary-scan-security
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-integration-br-test
  • /test pull-integration-mysql-test
  • /test unit-test

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test

In response to this:

/test check_dev2

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.

@guo-shaoge
Copy link
Collaborator Author

/test check-dev2

Signed-off-by: guo-shaoge <shaoge1994@163.com>
executor/cte.go Outdated Show resolved Hide resolved
Signed-off-by: guo-shaoge <shaoge1994@163.com>
This reverts commit 2c13472.
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
@guo-shaoge guo-shaoge requested a review from winoros June 20, 2023 03:09
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jun 20, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jun 20, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, wjhuang2016

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:
  • OWNERS [AilinKid,wjhuang2016]

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
Copy link

ti-chi-bot bot commented Jun 20, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-06-20 06:53:23.337705548 +0000 UTC m=+85768.738955996: ☑️ agreed by AilinKid.
  • 2023-06-20 08:45:37.666690036 +0000 UTC m=+92503.067940474: ☑️ agreed by wjhuang2016.

@guo-shaoge
Copy link
Collaborator Author

/test build
/test unit-test

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-5.4: #44840.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 20, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.1: #44842.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 20, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #44844.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 20, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #44846.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Jun 20, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
guo-shaoge added a commit to ti-chi-bot/tidb that referenced this pull request Jul 7, 2023
guo-shaoge added a commit to ti-chi-bot/tidb that referenced this pull request Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Got nil pointer error when multiple Apply is used with CTE
5 participants