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

log: generate digest and log it in slow log #9662

Merged
merged 6 commits into from
Mar 14, 2019
Merged

log: generate digest and log it in slow log #9662

merged 6 commits into from
Mar 14, 2019

Conversation

lysu
Copy link
Contributor

@lysu lysu commented Mar 12, 2019

What problem does this PR solve?

follow up to pingcap/parser#32, add digest to slow log

so we can awk or sql agg sql by digest to analysis query faster(even without pt-digest)

What is changed and how it works?

  • for each query generate digest and cache it in stmtCtx(later sql bind or audit can use it directly)
  • add slow log filed
  • add slow log table field
  • add admin show slow field(maybe we can do more use digest for show slow but maybe in following pr)

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Code changes

  • Add stmt variable

Side effects

  • Possible performance regression(but lexer is fast)

Related changes

  • Need to cherry-pick to the release 2.1 when master work well

This change is Reviewable

@codecov
Copy link

codecov bot commented Mar 12, 2019

Codecov Report

Merging #9662 into master will decrease coverage by 0.0118%.
The diff coverage is 76.4705%.

@@               Coverage Diff                @@
##             master      #9662        +/-   ##
================================================
- Coverage   67.4017%   67.3899%   -0.0119%     
================================================
  Files           377        377                
  Lines         79443      79457        +14     
================================================
  Hits          53546      53546                
- Misses        21117      21128        +11     
- Partials       4780       4783         +3

@jackysp
Copy link
Member

jackysp commented Mar 12, 2019

/run-all-tests

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

session/session.go Outdated Show resolved Hide resolved
@zz-jason zz-jason added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 14, 2019
@lysu
Copy link
Contributor Author

lysu commented Mar 14, 2019

/run-all-tests

zz-jason
zz-jason previously approved these changes Mar 14, 2019
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 status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 14, 2019
@lysu
Copy link
Contributor Author

lysu commented Mar 14, 2019

/run-all-tests

@lysu
Copy link
Contributor Author

lysu commented Mar 14, 2019

/run-common-test tidb-test=pr/755
/run-integration-common-test tidb-test=pr/755

@lysu
Copy link
Contributor Author

lysu commented Mar 14, 2019

/run-common-test tidb-test=pr/755
/run-integration-common-test tidb-test=pr/755

@lysu
Copy link
Contributor Author

lysu commented Mar 14, 2019

/run-all-tests tidb-test=pr/755

@lysu lysu merged commit e398322 into pingcap:master Mar 14, 2019
@lysu lysu deleted the dev-digest-log branch March 14, 2019 05:45
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/usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants