-
Notifications
You must be signed in to change notification settings - Fork 122
Multi-Cluster support for yamsql & support not-registering the driver with FRL #4042
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
2efabfb
First pass at multi-cluster support for yamsql
ScottDugas f4683ff
Add a smoke test to make sure the multi-cluster works
ScottDugas b0986b2
Implement multi-cluster support in multi-server (I think)
ScottDugas e450ac7
Improve multi-cluster testing
ScottDugas b99da67
Run a separate server for each cluster so that mixed-mode still works
ScottDugas 1b30cbd
Change InProcess to support multiple clusters
ScottDugas 0a10f47
Just use one list for cluster files
ScottDugas c3477f3
Suppress close warnings
ScottDugas dd18386
Remove old YamlConnectionFactory.getNewConnection
ScottDugas 68a9fbd
Add a tests to MultiServerConnectionFactoryTest that cover multiple c…
ScottDugas 47d1f66
Encapsulate list of server+clusterFile in class
ScottDugas 80a435a
Reuse Clusters in more places
ScottDugas 7d047a3
Add Clusters.primary()
ScottDugas 1ac4cda
Cleanup JDBCMultiServerConfig Clusters usage
ScottDugas 07d0ade
Remove unnecessary constructor
ScottDugas e024ded
Shuffle the order of the cluster files for yaml tests
ScottDugas caf94fa
Fix Clusters.empty()
ScottDugas 7c693f1
Fix javadoc
ScottDugas 1683e92
Fix singleVersionTest
ScottDugas fa0d4e1
Extract helper to decrease nesting
ScottDugas eb54486
Address easy PR comments
ScottDugas c552435
Make ExternalServer.clusterFile @Nonnull
ScottDugas 3bc08b4
Clarify Clusters javadoc
ScottDugas ce4969e
Add interface for things bound to a cluster
ScottDugas 5effd12
Address PR Comments
ScottDugas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/ConnectionTarget.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| /* | ||
| * ConnectionTarget.java | ||
| * | ||
| * This source file is part of the FoundationDB open source project | ||
| * | ||
| * Copyright 2015-2026 Apple Inc. and the FoundationDB project authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.apple.foundationdb.relational.yamltests; | ||
|
|
||
| import javax.annotation.Nonnull; | ||
| import java.net.URI; | ||
|
|
||
| /** | ||
| * A resolved connection target consisting of a URI and a cluster index. | ||
| * | ||
| * <p>The cluster index identifies which FDB cluster to connect to. Index 0 is the default. | ||
| * Additional clusters can be accessed in YAMSQL files using the map form | ||
| * of the {@code connect} directive: | ||
| * <pre>{@code | ||
| * connect: { cluster: 1, uri: 0 } | ||
| * }</pre> | ||
| * The uri component can be a few different things: | ||
| * <ul> | ||
| * <li>An index, in which case {@code 0} is the catalog, and other positive numbers refer to the schemas created | ||
| * automatically with the {@code schema_template:} block</li> | ||
| * <li>A fully qualified uri such as {@code "jdbc:embed:/FRL/MCI_DB?schema=S1"} or | ||
| * {@code "jdbc:embed:/__SYS?schema=CATALOG"}. The scheme should always be {@code jdbc:embed:}, and the framework | ||
| * will update it to control whether it goes to the embedded connection, or one of the servers.</li> | ||
| * </ul> | ||
| */ | ||
| public class ConnectionTarget { | ||
| @Nonnull | ||
| private final URI uri; | ||
| private final int clusterIndex; | ||
|
|
||
| public ConnectionTarget(@Nonnull URI uri, int clusterIndex) { | ||
| this.uri = uri; | ||
| this.clusterIndex = clusterIndex; | ||
| } | ||
|
|
||
| @Nonnull | ||
| public URI getUri() { | ||
| return uri; | ||
| } | ||
|
|
||
| public int getClusterIndex() { | ||
| return clusterIndex; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| if (clusterIndex == 0) { | ||
| return uri.toString(); | ||
| } | ||
| return uri + " [cluster=" + clusterIndex + "]"; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.