-
Notifications
You must be signed in to change notification settings - Fork 58
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
Java: AZ Awareness #2678
Java: AZ Awareness #2678
Conversation
5a8ecb8
to
34f1c0a
Compare
java/client/src/main/java/glide/managers/ConnectionManager.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/models/configuration/BaseClientConfiguration.java
Show resolved
Hide resolved
65baf97
to
cb101f3
Compare
ca8bf19
to
621a57c
Compare
java/client/src/main/java/glide/api/models/configuration/BaseClientConfiguration.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/managers/ConnectionManager.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/managers/ConnectionManager.java
Outdated
Show resolved
Hide resolved
java/client/src/test/java/glide/managers/ConnectionManagerTest.java
Outdated
Show resolved
Hide resolved
java/client/src/test/java/glide/managers/ConnectionManagerTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: TJ Zhang <[email protected]>
Signed-off-by: TJ Zhang <[email protected]>
Signed-off-by: TJ Zhang <[email protected]>
Signed-off-by: TJ Zhang <[email protected]>
d7561ec
to
00fe70e
Compare
java/client/src/main/java/glide/api/models/configuration/ReadFrom.java
Outdated
Show resolved
Hide resolved
java/client/src/main/java/glide/api/models/configuration/BaseClientConfiguration.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to have structure like
interface IReadFrom {}
enum ReadFrom implements IReadFrom { PRIMARY, REPLICA };
class AZ implements IReadFrom { String AZ };
It is more more correct, but will be a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Furthermore we need 2 different ReadFrom - for standalone and cluster. AZ option is not applicable for standalone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AZ is applicable for standalone
java/client/src/main/java/glide/managers/ConnectionManager.java
Outdated
Show resolved
Hide resolved
@@ -122,6 +123,14 @@ private ConnectionRequest.Builder setupConnectionRequestBuilderBaseConfiguration | |||
connectionRequestBuilder.setInflightRequestsLimit(configuration.getInflightRequestsLimit()); | |||
} | |||
|
|||
if (configuration.getReadFrom() == ReadFrom.AZ_AFFINITY) { | |||
if (configuration.getClientAZ() != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throw if building config for standalone client. Unfortunately, we can't restrict this in compile-time without introducing a breaking change.
Signed-off-by: TJ Zhang <[email protected]>
Signed-off-by: TJ Zhang <[email protected]>
java/client/src/main/java/glide/managers/ConnectionManager.java
Outdated
Show resolved
Hide resolved
java/client/src/test/java/glide/managers/ConnectionManagerTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: TJ Zhang <[email protected]>
@@ -84,6 +85,25 @@ tasks.register('startCluster') { | |||
} | |||
} | |||
|
|||
tasks.register('startClusterForAz') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really, we can use this cluster for any test, not just az awareness.
We should consider renaming this to something like startClusterWithMultipleReplicaNodes
or just startLargeCluster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not required for this PR, but let's consider splitting out our regular IT test framework from tests that require 'more setup'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we can move cluster setup to the IT test framework and let individual test files set up clusters
@@ -111,6 +112,17 @@ public static Map<String, String> parseInfoResponseToMap(String serverInfo) { | |||
return builder.useTLS(TLS); | |||
} | |||
|
|||
public static GlideClusterClientConfiguration.GlideClusterClientConfigurationBuilder<?, ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lots of common code between GlideClientConfigurationBuilder, GlideClusterClientConfigurationBuilder and GlideClusterClientConfigurationBuilder
new String[] {"INFO", "REPLICATION"}, | ||
new RequestRoutingConfiguration.SlotKeyRoute("key", PRIMARY)) | ||
.get(); | ||
long nReplicas = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌟
* Java: AZ awareness Signed-off-by: TJ Zhang <[email protected]>
Issue link
This Pull Request is linked to issue (URL): #643
Checklist
Before submitting the PR make sure the following are checked: