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

expression: add max_allowed_packet check in concat/concat_ws #11137

Merged
merged 15 commits into from
Jul 16, 2019

Conversation

amyangfei
Copy link
Contributor

What problem does this PR solve?

Return NULL and a warning when the result of function concat or concat_ws exceeds max_allowed_packet. ref: #7153

After this PR,

mysql> select @@global.max_allowed_packet;
+-----------------------------+
| @@global.max_allowed_packet |
+-----------------------------+
| 1024                        |
+-----------------------------+
1 row in set (0.00 sec)

mysql> select concat (repeat('a', 10), 'b');
+-------------------------------+
| concat (repeat('a', 10), 'b') |
+-------------------------------+
| aaaaaaaaaab                   |
+-------------------------------+
1 row in set (0.00 sec)

mysql> select concat (repeat('a', 1024), 'b');
+---------------------------------+
| concat (repeat('a', 1024), 'b') |
+---------------------------------+
| NULL                            |
+---------------------------------+
1 row in set, 1 warning (0.01 sec)

mysql> show warnings;
+---------+------+--------------------------------------------------------------------------+
| Level   | Code | Message                                                                  |
+---------+------+--------------------------------------------------------------------------+
| Warning | 1301 | Result of concat() was larger than max_allowed_packet (1024) - truncated |
+---------+------+--------------------------------------------------------------------------+
1 row in set (0.00 sec)

What is changed and how it works?

add max_allowed_packet check during evalString in builtinConcatWSSig and builtinConcatSig

Check List

Tests

  • Unit test
  • Integration test

Related changes

  • Need to cherry-pick to the release branch

@amyangfei amyangfei force-pushed the string-op-max-allowed-packet branch from de0b07f to 9b16346 Compare July 9, 2019 07:12
@amyangfei amyangfei force-pushed the string-op-max-allowed-packet branch from 9b16346 to 06f948d Compare July 9, 2019 07:21
@codecov
Copy link

codecov bot commented Jul 9, 2019

Codecov Report

Merging #11137 into master will decrease coverage by 0.4173%.
The diff coverage is 81.25%.

@@               Coverage Diff               @@
##            master     #11137        +/-   ##
===============================================
- Coverage   81.677%   81.2596%   -0.4174%     
===============================================
  Files          423        423                
  Lines        91699      90073      -1626     
===============================================
- Hits         74897      73193      -1704     
- Misses       11494      11577        +83     
+ Partials      5308       5303         -5

@amyangfei
Copy link
Contributor Author

/run-all-tests

@amyangfei
Copy link
Contributor Author

is this issue #7153 still needed to complete, PTAL @zz-jason

@amyangfei
Copy link
Contributor Author

/run-all-tests

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 15, 2019
@zz-jason zz-jason requested a review from SunRunAway July 15, 2019 15:38
expression/builtin_string.go Outdated Show resolved Hide resolved
expression/integration_test.go Outdated Show resolved Hide resolved
expression/builtin_string.go Show resolved Hide resolved
@amyangfei amyangfei force-pushed the string-op-max-allowed-packet branch 2 times, most recently from ea99452 to 51cf08e Compare July 16, 2019 06:28
@amyangfei amyangfei force-pushed the string-op-max-allowed-packet branch from 51cf08e to 1d3ebe9 Compare July 16, 2019 06:31
@amyangfei amyangfei force-pushed the string-op-max-allowed-packet branch from e2b789b to 6c765d4 Compare July 16, 2019 06:58
@SunRunAway
Copy link
Contributor

/run-all-tests

@SunRunAway SunRunAway added status/LGT2 Indicates that a PR has LGTM 2. and removed status/all tests passed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 16, 2019
Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

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

LGTM

@SunRunAway
Copy link
Contributor

/run-all-tests

@SunRunAway
Copy link
Contributor

Codecov is decreased but I have no idea how to fix it. Maybe we should consider fixing #11269 to solve this.

@sre-bot
Copy link
Contributor

sre-bot commented Apr 7, 2020

It seems that, not for sure, we failed to cherry-pick this commit to release-2.1. Please comment '/run-cherry-picker' to try to trigger the cherry-picker if we did fail to cherry-pick this commit before. @amyangfei PTAL.

@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Apr 8, 2020

/run-cherry-picker

@sre-bot
Copy link
Contributor

sre-bot commented Apr 8, 2020

cherry pick to release-2.1 in PR #16175

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants