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

importinto: fix panic when import to a temporary table, disallow import to cached table #55983

Merged
merged 3 commits into from
Sep 14, 2024

Conversation

D3Hunter
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #55970

Problem Summary:

What changed and how does it work?

add a check in plan build

Check List

Tests

  • Unit test
  • 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

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 10, 2024
Copy link

tiprow bot commented Sep 10, 2024

Hi @D3Hunter. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@D3Hunter D3Hunter changed the title importinto: fix panic when import to a temporary table, disable import to cached table too importinto: fix panic when import to a temporary table, disallow import to cached table too Sep 10, 2024
@D3Hunter D3Hunter changed the title importinto: fix panic when import to a temporary table, disallow import to cached table too importinto: fix panic when import to a temporary table, disallow import to cached table Sep 10, 2024
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Sep 10, 2024
Copy link

codecov bot commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.1267%. Comparing base (c8732f7) to head (e512e9a).
Report is 43 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #55983         +/-   ##
=================================================
- Coverage   72.8566%   57.1267%   -15.7299%     
=================================================
  Files          1605       1737        +132     
  Lines        446334     632838     +186504     
=================================================
+ Hits         325184     361520      +36336     
- Misses       101114     247780     +146666     
- Partials      20036      23538       +3502     
Flag Coverage Δ
integration 38.2730% <100.0000%> (?)
unit 73.0080% <100.0000%> (+1.0313%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 53.2668% <ø> (+7.5226%) ⬆️

@@ -4389,6 +4389,10 @@ func (b *PlanBuilder) buildImportInto(ctx context.Context, ld *ast.ImportIntoStm
}

tnW := b.resolveCtx.GetTableName(ld.Table)
if tnW.TableInfo.TempTableType != model.TempTableNone ||
tnW.TableInfo.TableCacheStatusType != model.TableCacheStatusDisable {
return nil, errors.Errorf("IMPORT INTO does not support temporary table or cached table")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you separate this message into "IMPORT INTO does not support temporary table" and "IMPORT INTO does not support cached table"? It is more clear and easy to extend to more checks if needed in the future

Copy link
Collaborator

@lcwangchao lcwangchao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REST LGTM

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 11, 2024
Copy link

ti-chi-bot bot commented Sep 11, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-10 09:30:48.526117091 +0000 UTC m=+348718.266541030: ☑️ agreed by lance6716.
  • 2024-09-11 01:15:44.181813545 +0000 UTC m=+405413.922237485: ☑️ agreed by lcwangchao.

@@ -4389,6 +4389,11 @@ func (b *PlanBuilder) buildImportInto(ctx context.Context, ld *ast.ImportIntoStm
}

tnW := b.resolveCtx.GetTableName(ld.Table)
if tnW.TableInfo.TempTableType != model.TempTableNone {
return nil, errors.Errorf("IMPORT INTO does not support temporary table")
} else if tnW.TableInfo.TableCacheStatusType != model.TableCacheStatusDisable {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else if tnW.TableInfo.TableCacheStatusType != model.TableCacheStatusDisable {
}
if tnW.TableInfo.TableCacheStatusType != model.TableCacheStatusDisable {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no difference

Copy link
Collaborator

@Benjamin2037 Benjamin2037 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lance6716
Copy link
Contributor

/assign @fixdb

@lance6716
Copy link
Contributor

/assign @winoros

Copy link

ti-chi-bot bot commented Sep 14, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Benjamin2037, hawkingrei, lance6716, lcwangchao

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 ti-chi-bot bot added the approved label Sep 14, 2024
@ti-chi-bot ti-chi-bot bot merged commit ae86e04 into pingcap:master Sep 14, 2024
23 checks passed
@D3Hunter D3Hunter deleted the fiximportinto-panic branch September 14, 2024 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using import into on temporary table will cause tidb crash
7 participants