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

feature: Add multi-node connection pool #189

Merged
merged 11 commits into from
Aug 23, 2024

Conversation

tommilligan
Copy link
Contributor

@tommilligan tommilligan commented Nov 22, 2021

Closes #57
Based on/supersedes #139 by @srleyva

Initially reviewed by @russcam and @swallez


This PR rebases #139 on top of current master, updates the added dependencies to current versions, and fixes clippy/deprecation warnings present in the diff.

I have maintained the original commit history for ease of picking up review from the existing PR - I believe everything after and including Add regex parsing bound_address to URL is unreviewed.

I have a couple of thoughts of potential improvements, but would like to hear from others before I sink any more time into this.

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@tommilligan tommilligan changed the title Static node list feature: Add mutli-node connection pool Nov 22, 2021
@tommilligan tommilligan changed the title feature: Add mutli-node connection pool feature: Add multi-node connection pool Nov 22, 2021
timeout,
)?;

spawn(move || {

Choose a reason for hiding this comment

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

if we require tokio to be around anyways, wouldn't it be better (in terms of resource usage etc.) to spawn a tokio task for the reseeding?

return Err(crate::error::lib("Bound Address is empty"));
}

let matches = ADDRESS_REGEX

Choose a reason for hiding this comment

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

I am a little uncomfortable using regex based parsing here. Wouldn't it be easier to check the address str for a valid scheme prefix? That would be http:// https:// and if it doesn't have one, prepend the given scheme, parse the url and then use Url::set_scheme?

@Licenser
Copy link

From the perspective of a user of the library, I'm a bit concerned over the number of unwrap() calls in the added logic. Would it be possible to replace them with some kind of handle error?

A library that uwraps/panics is really hard to deal with when it comes to providing helpful errors to users, using Result and some kind of Error allows the application to provide detail, hints, and additional help to a user as to what went wrong also it can then handle a failure gracefully - after all a hard stop of an application is not always the desired behavior on a failure in a library.

Copy link
Member

@swallez swallez left a comment

Choose a reason for hiding this comment

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

I have rebased on the latest main along with some fine-tuning (simplify node address parsing, and run reseed as a tokio task instead of a thread with a new runtime)

@swallez swallez merged commit 2fbcdd1 into elastic:main Aug 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Implement SniffingConnectionPool
6 participants