fix(Spanner): Added read-only validation for Mysql shards. This does not validate the user authority.#3658
Conversation
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 robustness of the Spanner-to-sourcedb data pipeline by adding a critical validation for MySQL shard connections. It ensures that the application does not attempt to establish connections to MySQL instances configured as read-only, thereby preventing potential data integrity issues or unexpected behavior during migration processes. This change improves the reliability of database interactions without affecting user authority. 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 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 counter productive. 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
|
77a3e06 to
cc05673
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3658 +/- ##
============================================
- Coverage 52.49% 52.47% -0.02%
- Complexity 5815 5817 +2
============================================
Files 1062 1062
Lines 64136 64145 +9
Branches 7089 7090 +1
============================================
- Hits 33668 33662 -6
- Misses 28189 28201 +12
- Partials 2279 2282 +3
🚀 New features to boost your workflow:
|
cc05673 to
04a28c3
Compare
| validateMysqlHikariConnection(ds); | ||
| connectionPoolMap.put(sourceConnectionUrl + "/" + shard.getUserName(), ds); |
There was a problem hiding this comment.
Is this class specific to MySQL? How does this work for PG and other JDBC sources?
|
|
||
| if (rs.next() && rs.getBoolean(1)) { | ||
| // Node is read-only. Close connection and throw exception. | ||
| throw new SQLException("Connection rejected: MySQL Shard is in read-only mode."); |
There was a problem hiding this comment.
Is it possible to add some helpful debugging data about the shard which was in read-only mode? The current error does not tell the user where the error is occurring?
| } | ||
|
|
||
| @Test | ||
| public void testInit_readOnlyShard_throwsException() throws SQLException { |
There was a problem hiding this comment.
Nit: Lets use the same naming convention as the existing tests. (camelCase?)
This does not validate the user authority.
04a28c3 to
dc26602
Compare
No description provided.