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: change slow log time format to compatible with pt-query-digest #10290

Merged
merged 3 commits into from
Apr 30, 2019

Conversation

crazycs520
Copy link
Contributor

What problem does this PR solve?

Exec below pt-query-digest with --since command will got error in old tidb slow log. Because of the slow log time format is not compatible with pt-query-digest.
pt-query-digest --type slowlog --output report --limit=100% --since "2019-04-28 15:26:06" tidb-slow.log

I try to find the MySQL slow log time format, But i got nothing in MySQL document or in google about the slow log time format. Then I check the MySQL slow log file, and find the most likely time format is RFC3339Nano, but not exactly the same.

Then I try to use RFC3339Nano time format, Then pt-query-digest with --since param will execute successfully. Then I chose RFC3339Nano format as the new slow log format.

What is changed and how it works?

Change slow log time format from "2006-01-02-15:04:05.999999999 -0700" to RFC3339Nano("2006-01-02T15:04:05.999999999Z07:00").

And for Slow_query parse slow_log compatibility, I still keep the old time format. Because if user was upgrade from old version, then there maybe 2 different time format in the same slow log file.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

Related changes

  • Need to cherry-pick to the release branch

@codecov
Copy link

codecov bot commented Apr 28, 2019

Codecov Report

Merging #10290 into master will decrease coverage by 0.0077%.
The diff coverage is 33.3333%.

@@               Coverage Diff                @@
##             master     #10290        +/-   ##
================================================
- Coverage   77.8256%   77.8178%   -0.0078%     
================================================
  Files           410        410                
  Lines         84715      84577       -138     
================================================
- Hits          65930      65816       -114     
+ Misses        13856      13845        -11     
+ Partials       4929       4916        -13

@codecov
Copy link

codecov bot commented Apr 28, 2019

Codecov Report

Merging #10290 into master will decrease coverage by 0.005%.
The diff coverage is 33.3333%.

@@               Coverage Diff                @@
##             master     #10290        +/-   ##
================================================
- Coverage   77.6699%   77.6648%   -0.0051%     
================================================
  Files           411        411                
  Lines         85441      85435         -6     
================================================
- Hits          66362      66353         -9     
- Misses        14117      14121         +4     
+ Partials       4962       4961         -1

Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@shenli shenli left a comment

Choose a reason for hiding this comment

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

LGTM

@shenli
Copy link
Member

shenli commented Apr 29, 2019

/run-all-tests

@crazycs520 crazycs520 merged commit 36bb1ae into pingcap:master Apr 30, 2019
@crazycs520 crazycs520 deleted the fix-slow-log-time-format branch April 30, 2019 01:35
@shenli
Copy link
Member

shenli commented Apr 30, 2019

@crazycs520 Please cherry-pick this to the release-2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants