Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

conn: add max idle conn config #280

Merged
merged 5 commits into from
Sep 10, 2019
Merged

Conversation

amyangfei
Copy link
Contributor

@amyangfei amyangfei commented Sep 10, 2019

What problem does this PR solve?

currently we use a single sql.DB connection pool for multiple concurrent executors in single DM-worker, each time one a txn is committed, the connection will be tried to put back to the idle connection pool. Too small idle connection pool size will lead to rejection of the put-back and database too many connections re-create.

What is changed and how it works?

set database MaxIdleConns according to worker-count

Check List

Tests

  • Unit test
  • Integration test

Code changes

Side effects

Related changes

  • Need to cherry-pick to the release branch
  • Need to be included in the release note
    • Fix a bug that may cause database connection re-establish too frequent

@amyangfei amyangfei added priority/important Major change, requires approval from ≥2 primary reviewers status/PTAL This PR is ready for review. Add this label back after committing new changes type/enhancement Performance improvement or refactoring needs-cherry-pick-release-1.0 This PR should be cherry-picked to release-1.0. Remove this label after cherry-picked to release-1.0 needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated labels Sep 10, 2019
syncer/db.go Outdated Show resolved Hide resolved
Copy link
Member

@csuzhangxc csuzhangxc left a comment

Choose a reason for hiding this comment

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

LGTM

@csuzhangxc csuzhangxc added status/LGT1 One reviewer already commented LGTM and removed status/PTAL This PR is ready for review. Add this label back after committing new changes labels Sep 10, 2019
@codecov
Copy link

codecov bot commented Sep 10, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@519c2ab). Click here to learn what that means.
The diff coverage is 40%.

@@             Coverage Diff             @@
##             master       #280   +/-   ##
===========================================
  Coverage          ?   60.0027%           
===========================================
  Files             ?        134           
  Lines             ?      14766           
  Branches          ?          0           
===========================================
  Hits              ?       8860           
  Misses            ?       5060           
  Partials          ?        846

@WangXiangUSTC WangXiangUSTC added status/LGT2 Two reviewers already commented LGTM, ready for merge and removed status/LGT1 One reviewer already commented LGTM labels Sep 10, 2019
Copy link
Contributor

@WangXiangUSTC WangXiangUSTC left a comment

Choose a reason for hiding this comment

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

LGTM

@amyangfei amyangfei merged commit b4dc58a into pingcap:master Sep 10, 2019
@amyangfei amyangfei deleted the add-max-idle-conn branch September 10, 2019 06:02
amyangfei added a commit to amyangfei/dm that referenced this pull request Sep 10, 2019
amyangfei added a commit that referenced this pull request Sep 10, 2019
@csuzhangxc csuzhangxc mentioned this pull request Sep 12, 2019
@amyangfei amyangfei added already-cherry-pick-1.0 The related PR is already cherry-picked to release-1.0. Add this label once the PR is cherry-picked already-update-release-note The release note is updated. Add this label once the release note is updated and removed needs-cherry-pick-release-1.0 This PR should be cherry-picked to release-1.0. Remove this label after cherry-picked to release-1.0 needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated labels Sep 23, 2019
lichunzhu pushed a commit to lichunzhu/dm that referenced this pull request Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
already-cherry-pick-1.0 The related PR is already cherry-picked to release-1.0. Add this label once the PR is cherry-picked already-update-release-note The release note is updated. Add this label once the release note is updated priority/important Major change, requires approval from ≥2 primary reviewers status/LGT2 Two reviewers already commented LGTM, ready for merge type/enhancement Performance improvement or refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants