Skip to content

Remove prefill logic from resource pool#11002

Merged
harshit-gangal merged 4 commits intovitessio:mainfrom
planetscale:settings-conn-manager
Aug 18, 2022
Merged

Remove prefill logic from resource pool#11002
harshit-gangal merged 4 commits intovitessio:mainfrom
planetscale:settings-conn-manager

Conversation

@harshit-gangal
Copy link
Member

Description

This PR modifies the resource pool by removing prefill logic and modifying benchmark tests.

Related Issue(s)

Checklist

  • "Backport me!" label has been added if this change should be backported
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

…dded pool benchmark

Signed-off-by: Harshit Gangal <harshit@planetscale.com>
@harshit-gangal harshit-gangal added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: Query Serving labels Aug 12, 2022
@vitess-bot
Copy link
Contributor

vitess-bot bot commented Aug 12, 2022

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • If this is a change that users need to know about, please apply the release notes (needs details) label so that merging is blocked unless the summary release notes document is included.
  • If a new flag is being introduced, review whether it is really needed. The flag names should be clear and intuitive (as far as possible), and the flag's help should be descriptive.
  • If a workflow is added or modified, each items in Jobs should be named in order to mark it as required. If the workflow should be required, the GitHub Admin should be notified.

Bug fixes

  • There should be at least one unit or end-to-end test.
  • The Pull Request description should either include a link to an issue that describes the bug OR an actual description of the bug and how to reproduce, along with a description of the fix.

Non-trivial changes

  • There should be some code comments as to why things are implemented the way they are.

New/Existing features

  • Should be documented, either by modifying the existing documentation or creating new documentation.
  • New features should have a link to a feature request issue or an RFC that documents the use cases, corner cases and test cases.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • vtctl command output order should be stable and awk-able.

@rsajwani
Copy link
Contributor

I went through RFC as well but not able to find if this change is part of proposal #1, 2 or 3 .. Can you give me more detail why removing pre-fill logic

@harshit-gangal
Copy link
Member Author

harshit-gangal commented Aug 16, 2022

I went through RFC as well but not able to find if this change is part of proposal #1, 2 or 3 .. Can you give me more detail why removing pre-fill logic

It is a small refactor of the pool, and not directly related to RFC.

The prefill logic was not used in vitess deployment as the default value is 0 and the connection pool should be having lazy behaviour regarding opening connections to mysql.

// it will wait till the next resource becomes available or a timeout.
// A timeout of 0 is an indefinite wait.
func (rp *ResourcePool) Get(ctx context.Context) (resource Resource, err error) {
span, ctx := trace.NewSpan(ctx, "ResourcePool.Get")
Copy link
Collaborator

Choose a reason for hiding this comment

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

this seems unrelated. Why remove the tracing here?

Copy link
Member Author

@harshit-gangal harshit-gangal Aug 18, 2022

Choose a reason for hiding this comment

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

The trace is already happening at one higher up level in connpool.Pool
Seems like an unnecessary trace.

	span.Annotate("capacity", p.Capacity())
	span.Annotate("in_use", p.InUse())
	span.Annotate("available", p.Available())
	span.Annotate("active", p.Active())

	if cp.timeout != 0 {
		var cancel context.CancelFunc
		ctx, cancel = context.WithTimeout(ctx, cp.timeout)
		defer cancel()
	}
	r, err := p.Get(ctx, nil)

@systay systay changed the title refactor: resource pool Remove prefill logic from resource pool Aug 18, 2022
@systay systay added the release notes (needs details) This PR needs to be listed in the release notes in a dedicated section (deprecation notice, etc...) label Aug 18, 2022
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
@harshit-gangal harshit-gangal removed the release notes (needs details) This PR needs to be listed in the release notes in a dedicated section (deprecation notice, etc...) label Aug 18, 2022
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
@harshit-gangal harshit-gangal merged commit f4f50ad into vitessio:main Aug 18, 2022
@harshit-gangal harshit-gangal deleted the settings-conn-manager branch August 18, 2022 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Query Serving Type: Enhancement Logical improvement (somewhere between a bug and feature)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants