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

*: record index name in the slow log instead of index id #11795

Merged
merged 10 commits into from
Aug 22, 2019

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Aug 20, 2019

What problem does this PR solve?

# Time: 2019-06-11T19:09:13.541025+08:00
....
# Index_ids: [1]
select id from t1 join t2 where t1.id=t2.id;

Index ID is not readable, and we can't know the index id 1 belonged to which table.

In This PR:

# Time: 2019-06-11T19:09:13.541025+08:00
....
# Index_names: [t1:a,t2:a]
....
select id from t1 join t2 where t1.id=t2.id;

It will record tableName:indexName in slow log.

What is changed and how it works?

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

Related changes

  • Need to cherry-pick to the release branch
    Release Note
  • Record index name in the slow log instead of index id for more readable.

@sre-bot
Copy link
Contributor

sre-bot commented Aug 20, 2019

Thanks for your PR.
This PR will be closed by bot because you already had 2 opened PRs, close or merge them before submitting a new one.
#11721 , #11794

@codecov
Copy link

codecov bot commented Aug 20, 2019

Codecov Report

Merging #11795 into master will decrease coverage by 0.2526%.
The diff coverage is 68.75%.

@@               Coverage Diff                @@
##             master     #11795        +/-   ##
================================================
- Coverage   81.6878%   81.4352%   -0.2527%     
================================================
  Files           435        434         -1     
  Lines         94216      93478       -738     
================================================
- Hits          76963      76124       -839     
- Misses        11795      11897       +102     
+ Partials       5458       5457         -1

@codecov
Copy link

codecov bot commented Aug 20, 2019

Codecov Report

Merging #11795 into master will increase coverage by 0.0907%.
The diff coverage is n/a.

@@               Coverage Diff                @@
##             master     #11795        +/-   ##
================================================
+ Coverage   81.4689%   81.5597%   +0.0907%     
================================================
  Files           435        435                
  Lines         94123      94467       +344     
================================================
+ Hits          76681      77047       +366     
+ Misses        11955      11937        -18     
+ Partials       5487       5483         -4

@crazycs520 crazycs520 reopened this Aug 20, 2019
@crazycs520
Copy link
Contributor Author

@winkyao @zz-jason PTAL

@@ -131,7 +131,7 @@ type StatementContext struct {
MemTracker *memory.Tracker
RuntimeStatsColl *execdetails.RuntimeStatsColl
TableIDs []int64
Copy link
Member

Choose a reason for hiding this comment

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

  1. How about using table names as well?
  2. How about using the table_name:index_name format to display table and index names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tableIDs is not be printed in the slow log.

Copy link
Member

Choose a reason for hiding this comment

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

If we do not print the table id, how do we know which table is accessed with an index if there are multiple tables doing the join operation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about store table_name:index_name in indexNames?

Copy link
Member

Choose a reason for hiding this comment

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

Sounds reasonable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

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
The slow log document should also be updated.

Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala zimulala added the status/LGT2 Indicates that a PR has LGTM 2. label Aug 22, 2019
@ngaut ngaut added the status/can-merge Indicates a PR has been approved by a committer. label Aug 22, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Aug 22, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Aug 22, 2019

@crazycs520 merge failed.

@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/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants