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

server: fix connection reset caused by alias length overflow #14870

Merged
merged 5 commits into from
Feb 25, 2020

Conversation

imtbkcat
Copy link

What problem does this PR solve?

Clients using binary protocol like PDO of PHP or JDBC, may occur error when query with very long alias, just like select (a very long if else expression) from t;

This is because the maxium size of column alias in mysql protocol is 256, but TiDB will return the long alias directly, MySQL will cut it until its less than 256 bytes.

https://dev.mysql.com/doc/refman/8.0/en/identifier-length.html

What is changed and how it works?

cut the name dump to 256 bytes.

Check List

Tests

  • Unit test

Code changes

  • None

Side effects

  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch

Release note

  • fix connection reset caused by alias length overflow.

Copy link
Contributor

@lysu lysu left a comment

Choose a reason for hiding this comment

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

LGTM, please fix lint

@lysu lysu added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 24, 2020
@codecov
Copy link

codecov bot commented Feb 24, 2020

Codecov Report

Merging #14870 into master will increase coverage by 0.0853%.
The diff coverage is 95.5882%.

@@               Coverage Diff                @@
##             master     #14870        +/-   ##
================================================
+ Coverage   80.2213%   80.3066%   +0.0853%     
================================================
  Files           503        503                
  Lines        130853     131100       +247     
================================================
+ Hits         104972     105282       +310     
+ Misses        17573      17532        -41     
+ Partials       8308       8286        -22

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

@jackysp
Copy link
Member

jackysp commented Feb 25, 2020

/merge

@sre-bot sre-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 25, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Feb 25, 2020

Your auto merge job has been accepted, waiting for 14769

@sre-bot
Copy link
Contributor

sre-bot commented Feb 25, 2020

/run-all-tests

@sre-bot sre-bot merged commit 18ce601 into pingcap:master Feb 25, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Feb 25, 2020

cherry pick to release-3.0 failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/server status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants