Seperated live migration 2#3947
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3947 +/- ##
=============================================
+ Coverage 38.10% 62.04% +23.94%
- Complexity 512 3102 +2590
=============================================
Files 195 545 +350
Lines 11745 32762 +21017
Branches 1173 3605 +2432
=============================================
+ Hits 4475 20326 +15851
- Misses 6908 11367 +4459
- Partials 362 1069 +707
🚀 New features to boost your workflow:
|
ccdab08 to
270feb0
Compare
270feb0 to
9c7379d
Compare
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 continues the effort to decouple source-specific logic from the standard migration template. By introducing a registry of source connectors, the codebase becomes more modular and easier to extend for future source types. The changes improve maintainability by centralizing source-specific behaviors and removing redundant factory classes. 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 refactors the Datastream to Spanner template to decouple source-specific logic by introducing the ISourceConnector interface and a SourceConnectorRegistry. This replaces the static factory classes (ChangeEventContextFactory and ChangeEventSequenceFactory) with dynamic connector lookups, improving extensibility for MySQL, PostgreSQL, and Oracle. A review comment points out a discrepancy in SourceConnectorRegistry where the Javadoc claims to use SPI for discovering connectors, but the implementation statically registers them instead.
Introduce a pluggable ISourceConnector interface to encapsulate all source-specific logic for MySQL, PostgreSQL, and Oracle databases within the datastream-to-spanner template. This replaces inline source-specific logic with a clean, decoupled design: - Created ISourceConnector interface. - Created MySqlSourceConnector, PostgresqlSourceConnector, and OracleSourceConnector implementing the interface. - Refactored SourceConnectorRegistry to manually register and manage these connectors (no AutoService/SPI dependency). - Updated SpannerTransactionWriterDoFn and ShadowTableCreator to interact with sources purely via the ISourceConnector interface. - Deleted obsolete ChangeEventContextFactory and ChangeEventSequenceFactory classes, delegating context and sequence creation to the connectors. - Kept all source-specific constants in DatastreamConstants (like in main) to preserve compatibility. - Removed auto-service dependency from pom.xml. - All changes are strictly restricted to the datastream-to-spanner template. TAG=agy CONV=b7fec87d-3652-43db-a0d1-64773a054415
9c7379d to
f7e7462
Compare
This is a part of the effort to separate source specific logic from the standard template logic for spanner migrations.
PR1 - #3942
PR 2 - Move source specific logic into connectors. This does not increase test coverage for any pre-existing code.
Following PRs will move the constants and bump up the test coverage.