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

[patch] bugfix ip discoverer disconnection too slow #344

Conversation

kpango
Copy link
Collaborator

@kpango kpango commented Apr 21, 2020

Signed-off-by: kpango i.can.feel.gravity@gmail.com

Description:

Discoverer client auto connects new founded remote origin but doesn't close old connection at that time, discovery client disconnects their connection during rebalance conn or health check conn, it makes problem for IP discovery connection pool client like gateway-agent connection, so I added disconnection logic when discovery new remotes.

Related Issue:

How Has This Been Tested?:

Environment:

  • Golang Version: 1.14
  • Docker Version: 19.03.5
  • Kubernetes Version: 1.17.3
  • NGT Version: 1.9.1

Types of changes:

  • Bug fix [type/bug]
  • New feature [type/feature]
  • Add tests [type/test]
  • Security related changes [type/security]
  • Add documents [type/documentation]
  • Refactoring [type/refactoring]
  • Update dependencies [type/dependency]
  • Update benchmarks and performances [type/bench]
  • Update CI [type/ci]

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Checklist:

  • I have read the CONTRIBUTING document.
  • I have checked open Pull Requests for the similar feature or fixes?
  • I have added tests and benchmarks to cover my changes.
  • I have ensured all new and existing tests passed.
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly.

@pull-assistant
Copy link

pull-assistant bot commented Apr 21, 2020

Score: 0.99

Best reviewed: commit by commit


Optimal code review plan

     [patch] bugfix ip discoverer disconnection too slow

     🤖 Update license headers and formatting go codes

     Update internal/net/grpc/pool/pool.go

Powered by Pull Assistant. Last update 1df18ea ... 01b0df0. Read the comment docs.

@kpango kpango force-pushed the bugfix/gateway-discoverer/ip-discovery-disconnection-too-slow-problem branch 6 times, most recently from 704338f to e28b46b Compare April 21, 2020 12:08
@kpango
Copy link
Collaborator Author

kpango commented Apr 21, 2020

@rinx this PR is ready, could you please review this PR?
and I strongly recommend release patch version about this.

@kpango
Copy link
Collaborator Author

kpango commented Apr 21, 2020

/rebase
/format

@vdaas-ci
Copy link
Collaborator

[REBASE] Rebase triggered by kpango for branch: bugfix/gateway-discoverer/ip-discovery-disconnection-too-slow-problem

Signed-off-by: kpango <i.can.feel.gravity@gmail.com>
@vdaas-ci vdaas-ci force-pushed the bugfix/gateway-discoverer/ip-discovery-disconnection-too-slow-problem branch from e28b46b to 1df18ea Compare April 21, 2020 17:06
@vdaas-ci
Copy link
Collaborator

[FORMAT] Updating license headers and formatting go codes triggered by kpango.

Signed-off-by: vdaas-ci <ci@vdaas.org>
@rinx rinx self-requested a review April 22, 2020 01:09
rinx
rinx previously approved these changes Apr 22, 2020
Copy link
Contributor

@rinx rinx left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@@ -201,6 +203,10 @@ func (p *pool) connect(ctx context.Context) (c Conn, err error) {
log.Debugf("establishing same connection to %s", p.addr)
conn, err := p.dial(ctx, p.addr)
if err != nil {
failCnt++
if p.isIP && (p.Len() <= 2 || failCnt >= p.Len()/3) {
Copy link
Contributor

Choose a reason for hiding this comment

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

badge
Why the if statement checks a condition that failCnt >= p.Len()/3? Where is the 3 coming from?
This is just a question.

Copy link
Collaborator Author

@kpango kpango Apr 22, 2020

Choose a reason for hiding this comment

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

If the IP connection fails, that is, the target IP is invalid or missing, or there is a network failure, you need to consider it. If there are less than two pool connections or 30% of the pool should immediately return an error.

internal/net/grpc/pool/pool.go Outdated Show resolved Hide resolved
Co-Authored-By: Rintaro Okamura <rintaro.okamura@gmail.com>
@rinx
Copy link
Contributor

rinx commented Apr 22, 2020

/approve

Copy link
Collaborator

@vdaas-ci vdaas-ci left a comment

Choose a reason for hiding this comment

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

[APPROVED] This PR is approved by rinx.

@kpango kpango merged commit 48ad9cc into master Apr 22, 2020
@kpango kpango deleted the bugfix/gateway-discoverer/ip-discovery-disconnection-too-slow-problem branch April 22, 2020 02:55
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