Skip to content

feat(Spanner): implement Standardize shard config in live migration. - #3934

Merged
pratickchokhani merged 2 commits into
GoogleCloudPlatform:mainfrom
pratickchokhani:shard-config-live
Jul 3, 2026
Merged

feat(Spanner): implement Standardize shard config in live migration.#3934
pratickchokhani merged 2 commits into
GoogleCloudPlatform:mainfrom
pratickchokhani:shard-config-live

Conversation

@pratickchokhani

Copy link
Copy Markdown
Contributor

No description provided.

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 15.90909% with 37 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.04%. Comparing base (3d09e7b) to head (4a49180).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
...oud/teleport/v2/templates/DataStreamToSpanner.java 15.00% 16 Missing and 1 partial ⚠️
...ud/teleport/v2/spanner/migrations/shard/Shard.java 11.11% 15 Missing and 1 partial ⚠️
...r/migrations/source/config/SourceConfigParser.java 33.33% 1 Missing and 3 partials ⚠️

❌ Your patch check has failed because the patch coverage (15.90%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3934      +/-   ##
============================================
+ Coverage     55.66%   62.04%   +6.37%     
+ Complexity     7184     3112    -4072     
============================================
  Files          1114      546     -568     
  Lines         68276    32811   -35465     
  Branches       7702     3619    -4083     
============================================
- Hits          38009    20357   -17652     
+ Misses        27804    11381   -16423     
+ Partials       2463     1073    -1390     
Components Coverage Δ
spanner-templates 87.99% <15.90%> (+0.18%) ⬆️
spanner-import-export ∅ <ø> (∅)
spanner-live-forward-migration 89.21% <15.90%> (-1.01%) ⬇️
spanner-live-reverse-replication 83.32% <16.66%> (-0.03%) ⬇️
spanner-bulk-migration 92.36% <16.66%> (-0.24%) ⬇️
gcs-spanner-dv 89.96% <16.66%> (+1.05%) ⬆️
Files with missing lines Coverage Δ
...r/migrations/source/config/SourceConfigParser.java 79.54% <33.33%> (-7.64%) ⬇️
...ud/teleport/v2/spanner/migrations/shard/Shard.java 70.58% <11.11%> (-15.98%) ⬇️
...oud/teleport/v2/templates/DataStreamToSpanner.java 88.84% <15.00%> (-5.81%) ⬇️

... and 632 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pratickchokhani pratickchokhani added the addition New feature or request label Jun 24, 2026
@pratickchokhani
pratickchokhani force-pushed the shard-config-live branch 4 times, most recently from 6ca19c2 to f855b09 Compare June 26, 2026 05:16
@pratickchokhani
pratickchokhani marked this pull request as ready for review June 26, 2026 05:28
@pratickchokhani
pratickchokhani requested a review from a team as a code owner June 26, 2026 05:28
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 standardizes the shard configuration mechanism for live migrations to Spanner. By transitioning from a legacy JSON-based sharding context file to a more flexible configuration format and renaming the associated pipeline parameter, the changes improve maintainability and align the configuration structure with broader project standards. The update includes necessary refactoring of the pipeline ingestion logic, Terraform infrastructure definitions, and comprehensive updates to existing integration tests.

Highlights

  • Configuration Parameter Rename: Renamed the configuration parameter 'shardingContextFilePath' to 'sourceConfigURL' across the codebase, documentation, and Terraform templates to better reflect its purpose.
  • Shard Configuration Schema Update: Updated the shard configuration format from a nested JSON map to a flat list of shard objects, improving readability and extensibility.
  • Pipeline Logic Refactoring: Updated the DataStreamToSpanner pipeline to parse the new 'sourceConfigURL' format directly, removing the dependency on the deprecated 'ShardingContextReader'.
  • Testing Improvements: Updated all integration tests to use the new configuration format and file naming conventions, ensuring consistency with the production changes.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request replaces the "shardingContextFilePath" parameter with "sourceConfigURL" across the "datastream-to-spanner" template, migrating the sharding configuration from a JSON map to a HOCON/JSON list format ("shardConfigs"). The feedback recommends adding defensive null checks: first, to ensure "shardConfigs" is not null in "SourceConfigParser" before sorting to prevent a NullPointerException, and second, to verify that "datastreamSourceType" is specified when "sourceConfigURL" is provided to avoid startup failures in retry modes.

@bharadwaj-aditya bharadwaj-aditya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTMd by mistake. Added some comments below

@bharadwaj-aditya bharadwaj-aditya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Couple of things need to be changed here.

Comment thread v2/datastream-to-spanner/terraform/samples/mysql-sharded-single-df-job/main.tf Outdated
@pratickchokhani
pratickchokhani force-pushed the shard-config-live branch 3 times, most recently from 49d6b0c to 0247d12 Compare July 1, 2026 09:09

@bharadwaj-aditya bharadwaj-aditya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@pratickchokhani
pratickchokhani merged commit 8f69190 into GoogleCloudPlatform:main Jul 3, 2026
31 of 32 checks passed
@pratickchokhani
pratickchokhani deleted the shard-config-live branch July 3, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addition New feature or request size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants