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

feat: Autoregister a target driver #748

Merged
merged 5 commits into from
Nov 23, 2023
Merged

Conversation

sergiyvamz
Copy link
Contributor

Summary

Automatically register the target driver in the class path

Additional Reviewers

@karenc-bq
@brunos-bq
@crystall-bitquill
@aaron-congo
@aaronchung-bitquill

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sergiyvamz sergiyvamz changed the title Autoregister a target driver feat: Autoregister a target driver Nov 21, 2023
@sergiyvamz sergiyvamz force-pushed the target-driver-autoregister branch from f106398 to 8105c28 Compare November 21, 2023 23:44
@sergiyvamz sergiyvamz force-pushed the target-driver-autoregister branch from 8105c28 to 70d874e Compare November 22, 2023 00:05
docs/using-the-jdbc-driver/UsingTheJdbcDriver.md Outdated Show resolved Hide resolved
@@ -232,6 +214,47 @@ public DriverPropertyInfo[] getPropertyInfo(final String url, final Properties i
return props;
}

private java.sql.Driver getTargetDriver(
final @NonNull String driverUrl,
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: driverURL

wrapper/src/main/java/software/amazon/jdbc/Driver.java Outdated Show resolved Hide resolved
return null;
}
TargetDriverHelper helper = new TargetDriverHelper();
java.sql.Driver driver = helper.getTargetDriver(driverUrl, props);
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: is getTargetDriver the right name for this function?
we first try to find if the driver is registered, then try to register the driver of the dialect

after this line, we either had a driver ready, either registered a new driver, either crashed
would instantiateDriver a better fit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method either return a target driver, or raises an exception.

What could be alternatives for getTargetDriver method name?


public class TargetDriverHelper {

public java.sql.Driver getTargetDriver(
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: it's a really minor thing but could we add some comments in some parts of the conditional just to explain the situation and what we're doing in that case

@@ -121,4 +139,40 @@ private void logDialect(final String dialectCode, final TargetDriverDialect targ
"TargetDriverDialectManager.useDialect",
new Object[] {dialectCode, targetDriverDialect}));
}

public boolean registerDriver(
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: can we add some comments on what we're doing in some conditions?

@sergiyvamz sergiyvamz enabled auto-merge (squash) November 23, 2023 01:09
@sergiyvamz sergiyvamz merged commit 35df6c9 into main Nov 23, 2023
5 checks passed
@sergiyvamz sergiyvamz deleted the target-driver-autoregister branch November 23, 2023 02:46
sergiyv-improving added a commit to Bit-Quill/aws-advanced-jdbc-wrapper that referenced this pull request Jan 11, 2024
* Configuration Profiles (aws#711)

Co-authored-by: sergiyvamz <svvoshch@amazon.com>

* chore(deps): bump org.testcontainers:postgresql from 1.19.1 to 1.19.2 (aws#743)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump io.vertx:vertx-stack-depchain from 4.4.6 to 4.5.0 (aws#745)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump org.testcontainers:junit-jupiter from 1.19.1 to 1.19.2 (aws#747)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump io.opentelemetry:opentelemetry-api from 1.31.0 to 1.32.0 (aws#746)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump com.fasterxml.jackson.core:jackson-databind from 2.15.3 to 2.16.0 (aws#744)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Disable failing integration test for PG driver (aws#742)

* Configuration Profiles documentation (aws#738)

* feat: Autoregister a target driver (aws#748)

* chore: reduce log level for intentionally ignored exceptions (aws#751)

* chore(deps): bump org.testcontainers:mariadb from 1.19.1 to 1.19.3 (aws#756)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump software.amazon.awssdk:secretsmanager from 2.21.21 to 2.21.31 (aws#762)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump io.opentelemetry:opentelemetry-sdk from 1.31.0 to 1.32.0 (aws#758)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump org.testcontainers:postgresql from 1.19.2 to 1.19.3 (aws#757)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump org.testcontainers:junit-jupiter from 1.19.2 to 1.19.3 (aws#759)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: node fastest response time strategy (aws#755)

* chore: update changelog and versioning for version 2.3.1 (aws#754)

* chore(deps): bump org.testcontainers:testcontainers from 1.19.1 to 1.19.3 (aws#771)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump org.mariadb.jdbc:mariadb-java-client from 3.3.0 to 3.3.1 (aws#767)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump org.apache.poi:poi-ooxml from 5.2.4 to 5.2.5 (aws#769)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump software.amazon.awssdk:secretsmanager from 2.21.31 to 2.21.38 (aws#772)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump software.amazon.awssdk:rds from 2.21.11 to 2.21.38 (aws#773)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump software.amazon.awssdk:rds from 2.21.38 to 2.21.42 (aws#776)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump org.postgresql:postgresql from 42.6.0 to 42.7.1 (aws#778)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump software.amazon.awssdk:secretsmanager from 2.21.38 to 2.21.43 (aws#781)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump io.opentelemetry:opentelemetry-exporter-otlp from 1.32.0 to 1.33.0 (aws#777)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: use existing entries to update the round robin cache (aws#739)

* set hostId in HostSpec (aws#782)

* docs: update HikariCP example to include configuring the datasource with a JDBC URL (aws#749)

* Enhanced host monitoring plugin ver.2 (aws#764)

* Fix: expose AuroraInitialConnectionStrategyPlugin with a plugin code (aws#784)

* feat: FederatedAuthConnectionPlugin (aws#741)

* chore: replace synchronized with locks in AwsCredentialsManager (aws#785)

* docs: FederatedAuthPlugin (aws#787)

Co-authored-by: Karen <64801825+karenc-bq@users.noreply.github.com>

* chore(deps): bump io.opentelemetry:opentelemetry-sdk-metrics from 1.32.0 to 1.33.0 (aws#792)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump software.amazon.awssdk:ec2 from 2.21.12 to 2.22.1 (aws#795)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump io.opentelemetry:opentelemetry-api from 1.32.0 to 1.33.0 (aws#794)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump org.junit.jupiter:junit-jupiter-params from 5.10.0 to 5.10.1 (aws#793)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Improve efm2 failure detection timing (aws#797)

* chore: update versioning and changelog (aws#791)

* fix: SqlMethodAnalyzer to handle empty SQL query and not throw IndexOutOfBoundsException (aws#798)

* Add documentation for read/write splitting Spring limitations (aws#800)

* Add example code for Read/Write Splitting sample (aws#765)

* fix: restructuring try blocks in dialects for exception handling (aws#799)

* chore(deps): bump software.amazon.awssdk:secretsmanager from 2.21.43 to 2.22.5 (aws#802)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump io.vertx:vertx-stack-depchain from 4.5.0 to 4.5.1 (aws#803)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump com.amazonaws:aws-xray-recorder-sdk-core from 2.14.0 to 2.15.0 (aws#804)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: add missing log message (aws#801)

Co-authored-by: Bruno Paiva Lima da Silva <64107800+brunos-bq@users.noreply.github.com>

* fix: making a variable volatile in RdsHostListProvider (aws#806)

* chore(deps): bump software.amazon.awssdk:ec2 from 2.22.1 to 2.22.9 (aws#808)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump io.opentelemetry:opentelemetry-sdk from 1.32.0 to 1.33.0 (aws#809)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump org.postgresql:postgresql from 42.6.0 to 42.7.1 (aws#810)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump tj-actions/changed-files from 37 to 41 in /.github/workflows (aws#811)

* transfer session state during failover (aws#814)

* feat: Session state transfer redesign (aws#821)

* chore(deps): bump software.amazon.awssdk:rds from 2.21.42 to 2.22.13 (aws#822)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump software.amazon.awssdk:sts from 2.21.42 to 2.22.13 (aws#823)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump com.fasterxml.jackson.core:jackson-databind from 2.16.0 to 2.16.1 (aws#818)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump com.github.spotbugs from 5.2.+ to 6.0.6 (aws#820)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Improve Multi-AZ cluster detection (aws#824)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Bruno Paiva Lima da Silva <64107800+brunos-bq@users.noreply.github.com>
Co-authored-by: sergiyvamz <svvoshch@amazon.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: sergiyvamz <75754709+sergiyvamz@users.noreply.github.com>
Co-authored-by: Karen <64801825+karenc-bq@users.noreply.github.com>
Co-authored-by: crystall-bitquill <97126568+crystall-bitquill@users.noreply.github.com>
Co-authored-by: aaronchung-bitquill <118320132+aaronchung-bitquill@users.noreply.github.com>
Co-authored-by: congoamz <75754763+congoamz@users.noreply.github.com>
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.

2 participants