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

executor: trace and control memory usage in DistSQL layer #10003

Merged
merged 17 commits into from
Apr 12, 2019

Conversation

qw4990
Copy link
Contributor

@qw4990 qw4990 commented Apr 2, 2019

What problem does this PR solve?

TiDB only traces and controls memory used in Executor layer now.
Some operators in DistSQL layer like selectResult and copIterator also have their own buffer that may use a lot of memory.
Memory usage in these operators should be traced and controlled by MemTracker.

What is changed and how it works?

Introduce a new field MemTracker in kv.Request to let operators in DistSQL layer use to trace and control memory usage.

For simplification, this PR only support tracing DistSQL operators created by TableReader, IndexReader and IndexLookup.
DistSQL operators created by Analyze will be supported by an another PR.

Check List

Tests

  • Unit test

@qw4990 qw4990 added the sig/execution SIG execution label Apr 2, 2019
@qw4990
Copy link
Contributor Author

qw4990 commented Apr 2, 2019

/rebuild

sessionctx/variable/session.go Outdated Show resolved Hide resolved
kv/kv.go Outdated Show resolved Hide resolved
kv/kv.go Outdated Show resolved Hide resolved
kv/kv.go Outdated Show resolved Hide resolved
distsql/request_builder.go Outdated Show resolved Hide resolved
store/tikv/coprocessor.go Show resolved Hide resolved
store/tikv/coprocessor.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Apr 3, 2019

Codecov Report

Merging #10003 into master will increase coverage by 0.0361%.
The diff coverage is 93.3333%.

@@               Coverage Diff               @@
##            master     #10003        +/-   ##
===============================================
+ Coverage   77.489%   77.5252%   +0.0361%     
===============================================
  Files          403        403                
  Lines        81898      81954        +56     
===============================================
+ Hits         63462      63535        +73     
+ Misses       13723      13706        -17     
  Partials      4713       4713

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

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

LGTM

@alivxxx alivxxx added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 10, 2019
distsql/distsql_test.go Outdated Show resolved Hide resolved
kv/kv.go Outdated Show resolved Hide resolved
store/tikv/coprocessor.go Outdated Show resolved Hide resolved
store/tikv/coprocessor.go Outdated Show resolved Hide resolved
distsql/select_result.go Show resolved Hide resolved
zz-jason
zz-jason previously approved these changes Apr 11, 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 Apr 11, 2019
@zz-jason
Copy link
Member

/run-all-tests

1 similar comment
@qw4990
Copy link
Contributor Author

qw4990 commented Apr 11, 2019

/run-all-tests

@zhouqiang-cl
Copy link
Contributor

/rebuild

@qw4990
Copy link
Contributor Author

qw4990 commented Apr 11, 2019

/run-all-tests

2 similar comments
@qw4990
Copy link
Contributor Author

qw4990 commented Apr 11, 2019

/run-all-tests

@qw4990
Copy link
Contributor Author

qw4990 commented Apr 11, 2019

/run-all-tests

@qw4990
Copy link
Contributor Author

qw4990 commented Apr 11, 2019

/run-all-tests

1 similar comment
@qw4990
Copy link
Contributor Author

qw4990 commented Apr 11, 2019

/run-all-tests

@qw4990
Copy link
Contributor Author

qw4990 commented Apr 12, 2019

/run-all-tests

@qw4990
Copy link
Contributor Author

qw4990 commented Apr 12, 2019

/run-all-tests

@qw4990
Copy link
Contributor Author

qw4990 commented Apr 12, 2019

All CI problems have been fixed, PTAL~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants