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

Allow setHostWeight() to work before cluster is started. #27

Merged

Conversation

AltSysrq
Copy link
Contributor

@AltSysrq AltSysrq commented Jun 5, 2020

Currently, it requires starting the cluster first, which makes configuration
needlessly awkward:

  1. Configure the driver
  2. Obtain at least one connection
  3. Finish configuring the driver

In our use case, configuration is handled by a shared library, but when the
connection gets created is not under that library's control, so there's not
even an opportunity to call 3.

This modifies setHostWeight() to not fail if called bofer clusters have been
initialised, and instead stores the configured weight in a static map. As new
clusters are created, they pull weights from that map when they have a matching
server.

Currently, it requires starting the cluster first, which makes configuration
needlessly awkward:

1. Configure the driver
2. Obtain at least one connection
3. Finish configuring the driver

In our use case, configuration is handled by a shared library, but when the
connection gets created is not under that library's control, so there's not
even an opportunity to call 3.

This modifies `setHostWeight()` to not fail if called bofer clusters have been
initialised, and instead stores the configured weight in a static map. As new
clusters are created, they pull weights from that map when they have a matching
server.
@jentfoo jentfoo added this to the 0.15 Release milestone Jun 5, 2020
@jentfoo
Copy link
Member

jentfoo commented Jun 5, 2020

LGTM, good idea. We need to update the version to 0.15-SNAPSHOT here https://github.com/threadly/auroraArc/blob/master/gradle.properties#L2 before I can merge. I can do this in master before hand if you don't want to.

@AltSysrq
Copy link
Contributor Author

AltSysrq commented Jun 5, 2020

Pushed a bump to that version.

@jentfoo jentfoo merged commit 7849277 into threadly:master Jun 5, 2020
@jentfoo
Copy link
Member

jentfoo commented Jun 7, 2020

This should be available in maven central as 0.15 now

@AltSysrq
Copy link
Contributor Author

AltSysrq commented Jun 8, 2020

@jentfoo Looks like only arcCommon was uploaded again — since nothing in the mysql module has changed since 0.13 it's not an immediate problem for me though

@jentfoo
Copy link
Member

jentfoo commented Jun 8, 2020

I double checked that they were included in the bundle being published. I wonder if maven is optimizing to not release versions with matching hashes?

Thanks for letting me know, that is a good point that 0.13 can be used otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants