[SpannerToSourceDb] Add support for URL-encoded connection properties and enable MySQL SSL based authentication - #4184
Conversation
… to enable MySQL SSL in spanner-to-sourcedb
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the database connection configuration logic to support URL-encoded properties. By allowing these properties to be parsed and applied to the Hikari connection pool, it enables better integration with databases requiring specific configurations, such as SSL-based authentication for MySQL. The changes ensure that connection strings can be passed in a standard URL format, improving flexibility for users configuring their source database connections. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for parsing connection properties containing delimiters like & or ; in both JdbcConnectionHelper and MySQLSpToSrcSourceConnector, along with corresponding unit tests. The reviewer feedback suggests URL-decoding the parsed keys and values to prevent connection failures when special characters are encoded, updating the unit tests to verify this decoding behavior, and refactoring the connector test to mock DriverManager for verifying connection properties.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4184 +/- ##
============================================
+ Coverage 55.90% 63.15% +7.24%
+ Complexity 7477 2786 -4691
============================================
Files 1134 562 -572
Lines 70135 32645 -37490
Branches 8014 3652 -4362
============================================
- Hits 39212 20616 -18596
+ Misses 28377 10984 -17393
+ Partials 2546 1045 -1501
🚀 New features to boost your workflow:
|
bharadwaj-aditya
left a comment
There was a problem hiding this comment.
Can you also check if you can bring up the test coverage. In cases where flags etc parsing is involved, it is good to cover all scenarios.
bharadwaj-aditya
left a comment
There was a problem hiding this comment.
LGTM.
Just check the usernames and passwords are not getting logged.
Also, as a follow up, we should do this for other sources as well.
Implement MySQL Client-to-Server SSL Connection support
This PR implements support for MySQL client-to-server SSL based connections in the
spanner-to-sourcedbtemplate.Steps to Connect to MySQL over Client-to-Server TLS
To establish a secure client-to-server TLS connection with MySQL, follow these steps:
extraFilesToStageparameter in your Dataflow execution command. For example:jdbc-shard-config.jsonfile, configure theconnectionPropertiesto reference the trust store. The path must be prefixed withfile:/extra_files/followed by the filename:Overview of the Changes
extraFilesToStageas a mechanism to mount the trust store on the Dataflow worker machines.JdbcConnectionHelperis updated to correctly split and parse standard URL-encoded parameters (delimited by∨), allowing standard JDBC SSL parameters to be loaded into theHikariConfigfor the pipeline runtime.MySQLSpToSrcSourceConnectorwas updated to parse these URL-encoded properties to ensure the initial pre-flight validation and schema discovery connections also successfully authenticate over SSL.Unit Testing
All newly introduced code paths and property parsing logic in this commit are fully covered by unit tests.