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

stats: reduce stats collecor's lock contention #9233

Merged
merged 2 commits into from Feb 25, 2019

Conversation

Projects
None yet
4 participants
@lamxTyler
Copy link
Member

commented Jan 31, 2019

What problem does this PR solve?

We will create a session stats collector for each session and link them into a list. So when there are many sessions, it will take longer to loop the list, and holding the list head's lock during the whole process will block other operations, like NewSessionStatsCollector.

What is changed and how it works?

When looping the list, only holds the lock of necessary stats collector, that is the previous one and current. So it will only holds at most two locks at the same time.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

  • None

Related changes

  • None
@codecov-io

This comment has been minimized.

Copy link

commented Jan 31, 2019

Codecov Report

Merging #9233 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #9233      +/-   ##
=========================================
- Coverage    67.3%   67.3%   -0.01%     
=========================================
  Files         373     373              
  Lines       78449   78441       -8     
=========================================
- Hits        52803   52795       -8     
+ Misses      20911   20910       -1     
- Partials     4735    4736       +1
Impacted Files Coverage Δ
statistics/update.go 83.69% <100%> (-0.28%) ⬇️
ddl/session_pool.go 82.75% <0%> (-10.35%) ⬇️
ddl/delete_range.go 78.83% <0%> (-0.53%) ⬇️
store/tikv/scan.go 77.31% <0%> (+3.36%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f80e401...13c3179. Read the comment docs.

@zz-jason zz-jason requested a review from eurekaka Feb 18, 2019

@winoros
Copy link
Member

left a comment

lgtm

@winoros winoros added the status/LGT1 label Feb 19, 2019

@zz-jason
Copy link
Member

left a comment

LGTM

@zz-jason zz-jason added status/LGT2 and removed status/LGT1 labels Feb 25, 2019

@zz-jason

This comment has been minimized.

Copy link
Member

commented Feb 25, 2019

/run-all-tests

@lamxTyler lamxTyler merged commit 9a8a0d8 into pingcap:master Feb 25, 2019

13 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
idc-jenkins-ci-tidb/build Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/check_dev Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/common-test job succeeded
Details
idc-jenkins-ci-tidb/integration-common-test Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/integration-compatibility-test Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/integration-ddl-test Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/mybatis-test job succeeded
Details
idc-jenkins-ci-tidb/sqllogic-test-1 Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/sqllogic-test-2 Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/unit-test Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@lamxTyler lamxTyler deleted the lamxTyler:stats-collector branch Feb 25, 2019

lamxTyler added a commit to lamxTyler/tidb that referenced this pull request Feb 25, 2019

zz-jason added a commit that referenced this pull request Feb 25, 2019

yu34po added a commit to yu34po/tidb that referenced this pull request Feb 27, 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.