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

Java: AZ Awareness #2678

Merged
merged 7 commits into from
Nov 20, 2024
Merged

Java: AZ Awareness #2678

merged 7 commits into from
Nov 20, 2024

Conversation

tjzhang-BQ
Copy link
Collaborator

@tjzhang-BQ tjzhang-BQ commented Nov 13, 2024

Issue link

This Pull Request is linked to issue (URL): #643

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated.
  • CHANGELOG.md and documentation files are updated.
  • Destination branch is correct - main or release
  • Commits will be squashed upon merging.

@tjzhang-BQ tjzhang-BQ added the java issues and fixes related to the java client label Nov 13, 2024
TJ Zhang added 4 commits November 18, 2024 12:18
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]>
Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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

@@ -122,6 +123,14 @@ private ConnectionRequest.Builder setupConnectionRequestBuilderBaseConfiguration
connectionRequestBuilder.setInflightRequestsLimit(configuration.getInflightRequestsLimit());
}

if (configuration.getReadFrom() == ReadFrom.AZ_AFFINITY) {
if (configuration.getClientAZ() != null) {
Copy link
Collaborator

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]>
@@ -84,6 +85,25 @@ tasks.register('startCluster') {
}
}

tasks.register('startClusterForAz') {
Copy link
Collaborator

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

Copy link
Collaborator

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'.

Copy link
Collaborator

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<?, ?>
Copy link
Collaborator

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 =
Copy link
Collaborator

Choose a reason for hiding this comment

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

🌟

@tjzhang-BQ tjzhang-BQ merged commit 408ca25 into release-1.2 Nov 20, 2024
15 of 16 checks passed
@tjzhang-BQ tjzhang-BQ deleted the java/tjz-azawareness branch November 20, 2024 23:00
prateek-kumar-improving pushed a commit that referenced this pull request Nov 26, 2024
* Java: AZ awareness

Signed-off-by: TJ Zhang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java issues and fixes related to the java client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants