Skip to content

Multi-Cluster support for yamsql & support not-registering the driver with FRL#4042

Merged
ScottDugas merged 25 commits intoFoundationDB:mainfrom
ScottDugas:copy-yamsql
Apr 22, 2026
Merged

Multi-Cluster support for yamsql & support not-registering the driver with FRL#4042
ScottDugas merged 25 commits intoFoundationDB:mainfrom
ScottDugas:copy-yamsql

Conversation

@ScottDugas
Copy link
Copy Markdown
Collaborator

@ScottDugas ScottDugas commented Apr 2, 2026

The primary purpose here is to support multi-cluster testing to yaml tests.
In order to support this, a new option was added to FRL to not-register the driver so that you can create multiple different FRL instances, pointing to different clusters.

This is part of the work for: #3823

@ScottDugas ScottDugas added enhancement New feature or request testing improvement Change that improves our testing labels Apr 2, 2026
@ScottDugas ScottDugas added the Run mixed-mode Label to add to Pull Requests to have it run mixed mode tests label Apr 3, 2026
@ScottDugas ScottDugas marked this pull request as ready for review April 3, 2026 18:41
Comment thread yaml-tests/src/test/resources/multi-cluster-isolation.yamsql
* @throws SQLException if the index is out of range
*/
@Nonnull
public Entry<T> get(int clusterIndex) throws SQLException {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it make it easier to track if cluster would be identified by its file name rather than an index? Is there a method to the naming of the actual cluster files that would make tests easier to write when they actually are implemented?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

File names are developer/environment dependent. We could give them names via the framework, but that would probably just be names like cluster1, which doesn't really improve the situation over using 1.
The idea here is primarily to support different identical clusters, so the key is not that 0 means something, just that it is consistent within the file so that you can control whether you are accessing the same or different clusters.

public static List<String> allClusterFilesInRandomOrder() {
final List<String> randomized = new ArrayList<>(clusterFiles);
Collections.shuffle(randomized);
return List.copyOf(randomized);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the copy necessary in this case? Can also return immutableList()

@Nonnull
private Clusters<FRL> clusters = Clusters.empty();

public EmbeddedConfig(@Nullable final String clusterFile) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given the current setup, can clusterFile really be null?

Fixing names, javadoc, nullability annotations, removing unused code,
using identical super method.
This ends up being slightly less useful than maybe desired, because
most of the things that Clusters holds are production classes, and
I don't want to add a new interface there (and we're not writing
swift code)
Comment thread yaml-tests/src/test/resources/multi-cluster-isolation.yamsql Outdated
I also cleaned up a couple of the yaml test tests that were more
complicated than they needed to be.
@ScottDugas ScottDugas requested a review from g31pranjal April 21, 2026 15:00
Copy link
Copy Markdown
Member

@g31pranjal g31pranjal left a comment

Choose a reason for hiding this comment

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

LGTM!

@ScottDugas ScottDugas merged commit 5d5f64d into FoundationDB:main Apr 22, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Run mixed-mode Label to add to Pull Requests to have it run mixed mode tests testing improvement Change that improves our testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants