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

Simplify config loading #102

Merged
merged 1 commit into from
Feb 10, 2025
Merged

Simplify config loading #102

merged 1 commit into from
Feb 10, 2025

Conversation

ryannedolan
Copy link
Collaborator

@ryannedolan ryannedolan commented Feb 9, 2025

Summary

  • Do not load JDBC driver configuration from ConfigService. Instead, rely on connection properties.
  • Add catalogs connection property to limit loaded catalogs.
  • Properly load connection properties from JDBC URL or via getConnection() argument.

Details

Previously, ConfigService was used within various plugins (e.g. JDBC drivers) to load dynamic configuration. Some of these cases are now obviated by #99's connection properties, which thread through to each plugin, except JDBC drivers. For JDBC drivers, we prefer to use their respective URL, when possible, since relying on ConfigService may involve dynamically fetching configurations (e.g. ConfigMaps) when loading each database.

In addition, we will want to support a CREATE DATABASE eventually, which won't be able to provide the out-of-band configuration that ConfigService needs. For example, we can have create database foo.bar location 'jdbc:foo://cluster=bar;fabric=prod', which fully specifies the external connection. We don't need to additionally supply a configmap out-of-band.

Testing

Verified manually with client.

@ryannedolan ryannedolan requested a review from jogrogan February 10, 2025 16:10
Comment on lines 38 to +39
properties.putAll(ConnectStringParser.parse(url.substring(getConnectStringPrefix().length())));
properties.putAll(props); // in case the driver is loaded via getConnection()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these lines be reversed? Trying to think if there are config collisions, which should take precedence. I'd think the connection properties should (same as you have for HoptimatorDriver)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The JDBC spec says the precedence order is undefined and driver specific! So whatever makes sense to us I guess. Agree that the URL should take precedence, since that is more likely to be what end users are actually able to manipulate. Will fix, thx.

Comment on lines 42 to +43
properties.putAll(ConnectStringParser.parse(url.substring(getConnectStringPrefix().length())));
properties.putAll(props); // in case the driver is loaded via getConnection()
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

@ehoner ehoner merged commit a15f08f into main Feb 10, 2025
1 check passed
@ehoner ehoner deleted the simplify-configs branch February 10, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants