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

Instantiate single YBClient instances for multiple methods #286

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vaibhav-yb
Copy link
Collaborator

Problem

We have helper methods which take in the configuration and create a YBClient instance of their own to execute RPC calls. However, they may end up creating multiple instances of YBClient which may lead to a memory/file leak if they're not garbage collected on time.

Another scenario where this could lead to a problem would be when heavily doing task/connector restarts as we will open a socket every time we create an instance of YBClient.

Solution

This PR is a small step to mitigate the problem a little by reusing the YBClient instances wherever necessary.

Additional notable changes in the PR:

  1. Removed a redundant call to method YugabyteDBConnector#validateTserverConnection
  2. Logging modifications to have more info in the logs - changed a few debug logs to info as they were only being logged once.
  3. Some lint refactors included by the IDE itself.

@vaibhav-yb vaibhav-yb added the enhancement New feature or request label Oct 19, 2023
@vaibhav-yb vaibhav-yb self-assigned this Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant