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

executor: load data statement shoule not be prepared (#21188) #21199

Merged
merged 3 commits into from
Nov 24, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #21188 to release-4.0


What problem does this PR solve?

tidb throw unexpected error while execute load data statement in prepare statement

Problem Summary:

The current error is:
‘Load data: previous load data option isn't closed normal’。
expected error is:
‘This command is not supported in the prepared statement protocol yet‘

What is changed and how it works?

What's Changed:

add a logic, if there is load data in prepare statement, return error 'ErrUnsupportedPs'

How it Works:
add a logic, if there is load data in prepare statement, return error 'ErrUnsupportedPs'

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  1. execute
    load data local infile 't1.txt' into table t1 fields terminated by '|' ignore 1 lines
  2. below log will show in the log file.

[2020/11/22 21:31:11.349 +08:00] [INFO] [conn.go:801] ["command dispatched failed"] [conn=2199023255557] [connInfo="id:2199023255557, addr:127.0.0.1:56357 status:10, collation:utf8_general_ci, user:root"] [command=Prepare] [status="inTxn:0, autocommit:1"] [sql="load data local infile 't1.txt' into table t1 fields terminated by '|' ignore 1 lines"] [txn_mode=OPTIMISTIC] [err="[executor:1295]This command is not supported in the prepared statement protocol yet"]

  • No code

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM
  • Breaking backward compatibility

Release note

  • Raise an error when preparing the load data statement.

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot added first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. sig/execution SIG execution type/4.0-cherry-pick type/bugfix This PR fixes a bug. labels Nov 23, 2020
@ti-srebot ti-srebot added this to the v4.0.9 milestone Nov 23, 2020
@ti-srebot ti-srebot self-assigned this Nov 23, 2020
@ti-srebot
Copy link
Contributor Author

@ti-srebot you're already a collaborator in bot's repo.

@jackysp
Copy link
Member

jackysp commented Nov 23, 2020

Please resolve conflicts, @sev7ndayyoo

@7yyo
Copy link
Contributor

7yyo commented Nov 23, 2020

/cherry-pick-invite

@ti-srebot
Copy link
Contributor Author

This command can used by organization's member only.

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 23, 2020
Copy link
Contributor

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 24, 2020
@jackysp
Copy link
Member

jackysp commented Nov 24, 2020

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 24, 2020
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot ti-srebot merged commit 3326edc into pingcap:release-4.0 Nov 24, 2020
jackysp pushed a commit to qw4990/tidb that referenced this pull request Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants