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

infoschema/slow_query: fix shallow copy problem #10696

Merged
merged 7 commits into from
Jun 4, 2019

Conversation

crazycs520
Copy link
Contributor

What problem does this PR solve?

tidb-slow.log
parse upper slow log and execute below:

root:information_schema> select user, db,digest from slow_query where user != "";
+----------+--------------------+------------------------------------------------------------------+
| user     | db                 | digest                                                           |
+----------+--------------------+------------------------------------------------------------------+
| riv,Crea |                    | ow_db_priv,Super_priv,Execute_priv,Create_view_priv,Show_view_pr |
| nternal: | 0381ff1b5c2994d657 | s_priv:pseudo                                                    |
|          |                    | # Num_cop_tasks: 1                                               |
|          |                    | # Cop_proc_avg: 0 Cop_proc_p90:                                  |
| lumns_pr |  Txn_start_ts: 408 | 00136655                                                         |
|          |                    | # Wait_time: 0.001 Request_count: 1 Total_keys: 1                |
|          |                    | # Is_                                                            |
+----------+--------------------+------------------------------------------------------------------+
3 rows in set

There are some wrong value in user, db.

after fix:

root:information_schema> select user, db,digest from slow_query where user != "";
+----------+--------------------+------------------------------------------------------------------+
| user     | db                 | digest                                                           |
+----------+--------------------+------------------------------------------------------------------+
| root@::1 |                    | f106b0f6c630f454d31b008fbb034fda10f2441fd0477a9990e22b7df313f59a |
| root@::1 | information_schema | b4dae6a771c1d84157dcc302bef38cbff77a7a8ff89ee38302ac3324485454a3 |
| root@::1 | information_schema | b4dae6a771c1d84157dcc302bef38cbff77a7a8ff89ee38302ac3324485454a3 |
+----------+--------------------+------------------------------------------------------------------+
3 rows in set

What is changed and how it works?

Fix this by add copy.

Check List

Tests

  • I can't reproduce this in a simple unit test ...

@crazycs520 crazycs520 added the type/bugfix This PR fixes a bug. label Jun 4, 2019
infoschema/slow_log.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 4, 2019

Codecov Report

Merging #10696 into master will increase coverage by 0.0069%.
The diff coverage is 100%.

@@               Coverage Diff                @@
##             master     #10696        +/-   ##
================================================
+ Coverage   78.3279%   78.3348%   +0.0069%     
================================================
  Files           414        414                
  Lines         87666      87717        +51     
================================================
+ Hits          68667      68713        +46     
- Misses        13854      13857         +3     
- Partials       5145       5147         +2

@codecov
Copy link

codecov bot commented Jun 4, 2019

Codecov Report

Merging #10696 into master will decrease coverage by 0.0089%.
The diff coverage is 100%.

@@               Coverage Diff               @@
##             master     #10696       +/-   ##
===============================================
- Coverage   79.6453%   79.6364%   -0.009%     
===============================================
  Files           414        414               
  Lines         87690      87681        -9     
===============================================
- Hits          69841      69826       -15     
- Misses        12677      12685        +8     
+ Partials       5172       5170        -2

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 Jun 4, 2019
@coocood
Copy link
Member

coocood commented Jun 4, 2019

LGTM

@coocood coocood added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 4, 2019
@crazycs520
Copy link
Contributor Author

/run-all-tests

@crazycs520
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

LGTM

@crazycs520
Copy link
Contributor Author

/run-all-tests

@crazycs520
Copy link
Contributor Author

/run-all-tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants