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

Projects
None yet
4 participants
@crazycs520
Copy link
Contributor

commented Jun 4, 2019

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 requested review from tiancaiamao and zz-jason Jun 4, 2019

Show resolved Hide resolved infoschema/slow_log.go Outdated
@codecov

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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
@zz-jason
Copy link
Member

left a comment

LGTM

@zz-jason zz-jason added the status/LGT1 label Jun 4, 2019

@coocood

This comment has been minimized.

Copy link
Member

commented Jun 4, 2019

LGTM

@coocood coocood added status/LGT2 and removed status/LGT1 labels Jun 4, 2019

@crazycs520

This comment has been minimized.

Copy link
Contributor Author

commented Jun 4, 2019

/run-all-tests

crazycs520 added some commits Jun 4, 2019

@crazycs520

This comment has been minimized.

Copy link
Contributor Author

commented Jun 4, 2019

/run-all-tests

@winkyao
Copy link
Member

left a comment

LGTM

@winkyao

winkyao approved these changes Jun 4, 2019

@crazycs520

This comment has been minimized.

Copy link
Contributor Author

commented Jun 4, 2019

/run-all-tests

@crazycs520

This comment has been minimized.

Copy link
Contributor Author

commented Jun 4, 2019

/run-all-tests

@coocood coocood merged commit ea489c8 into pingcap:master Jun 4, 2019

8 checks passed

ci/circleci Your tests passed on CircleCI!
Details
codecov/patch 100% of diff hit (target 0%)
Details
codecov/project Absolute coverage decreased by -0.0089% but relative coverage increased by +20.3546% compared to 8883c78
Details
idc-jenkins-ci-tidb/build Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/build_check_race Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/check_dev Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/check_dev_2 Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

crazycs520 added a commit to crazycs520/tidb that referenced this pull request Jun 6, 2019

crazycs520 added a commit to crazycs520/tidb that referenced this pull request Jun 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.