Skip to content

feat(Spanner): integrate SourceConfigParser to centralize shard configuration loading for SourceDbToSpanner pipelines. - #3854

Open
pratickchokhani wants to merge 16 commits into
GoogleCloudPlatform:mainfrom
pratickchokhani:shard-config-bulk
Open

feat(Spanner): integrate SourceConfigParser to centralize shard configuration loading for SourceDbToSpanner pipelines.#3854
pratickchokhani wants to merge 16 commits into
GoogleCloudPlatform:mainfrom
pratickchokhani:shard-config-bulk

Conversation

@pratickchokhani

@pratickchokhani pratickchokhani commented May 25, 2026

Copy link
Copy Markdown
Contributor
  1. Implemented centralize shard configuration loading for SourceDbToSpanner
  2. Added integration tests for Astra DB
  3. Updated integration tests across the template.

@pratickchokhani pratickchokhani added the addition New feature or request label May 25, 2026
@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.41667% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.09%. Comparing base (46df425) to head (7007b5f).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...loud/teleport/v2/templates/PipelineController.java 0.00% 7 Missing ⚠️
...ource/jdbc/AbstractJdbcSrcToSpSourceConnector.java 0.00% 4 Missing ⚠️
...cloud/teleport/v2/templates/SourceDbToSpanner.java 83.33% 1 Missing and 1 partial ⚠️
...rce/cassandra/CassandraSrcToSpSourceConnector.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3854      +/-   ##
============================================
- Coverage     56.10%   56.09%   -0.01%     
+ Complexity     7319     7310       -9     
============================================
  Files          1126     1126              
  Lines         68550    68555       +5     
  Branches       7753     7754       +1     
============================================
+ Hits          38457    38459       +2     
+ Misses        27610    27609       -1     
- Partials       2483     2487       +4     
Components Coverage Δ
spanner-templates 87.63% <83.72%> (+0.07%) ⬆️
spanner-import-export 68.86% <ø> (-0.17%) ⬇️
spanner-live-forward-migration 89.47% <ø> (+0.20%) ⬆️
spanner-live-reverse-replication 83.60% <ø> (+0.16%) ⬆️
spanner-bulk-migration 92.33% <83.72%> (+0.10%) ⬆️
gcs-spanner-dv 88.78% <ø> (+0.23%) ⬆️
Files with missing lines Coverage Δ
...eam/it/gcp/cloudsql/CloudSqlShardOrchestrator.java 85.83% <100.00%> (-0.52%) ⬇️
...ud/teleport/v2/options/OptionsToConfigBuilder.java 92.94% <100.00%> (-0.40%) ⬇️
...ud/teleport/v2/source/ISrcToSpSourceConnector.java 100.00% <ø> (ø)
...cassandra/iowrapper/CassandraIOWrapperFactory.java 100.00% <100.00%> (ø)
.../cassandra/iowrapper/CassandraIOWrapperHelper.java 100.00% <100.00%> (ø)
...der/io/cassandra/iowrapper/CassandraIoWrapper.java 100.00% <ø> (ø)
...t/v2/source/jdbc/ShardedJdbcDbConfigContainer.java 100.00% <100.00%> (ø)
...urce/jdbc/SingleInstanceJdbcDbConfigContainer.java 100.00% <100.00%> (ø)
...t/v2/source/mysql/MySqlSrcToSpSourceConnector.java 98.85% <100.00%> (-0.02%) ⬇️
...ource/postgres/PostgresSrcToSpSourceConnector.java 98.92% <100.00%> (-0.02%) ⬇️
... and 4 more

... and 12 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 force-pushed the shard-config-bulk branch 6 times, most recently from a19cf9e to 581ffd3 Compare June 29, 2026 07:25
@pratickchokhani
pratickchokhani force-pushed the shard-config-bulk branch 4 times, most recently from 0da7475 to e13bdd2 Compare June 30, 2026 14:13
@pull-request-size pull-request-size Bot added size/XL and removed size/L labels Jul 1, 2026
@pratickchokhani
pratickchokhani force-pushed the shard-config-bulk branch 3 times, most recently from 41f2355 to 461938b Compare July 2, 2026 10:46
@pratickchokhani
pratickchokhani marked this pull request as ready for review July 2, 2026 10:55
@pratickchokhani
pratickchokhani requested a review from a team as a code owner July 2, 2026 10:55
@pratickchokhani
pratickchokhani requested review from jsuhani-2026 and sm745052 and removed request for sm745052 July 2, 2026 10:55
@pratickchokhani
pratickchokhani force-pushed the shard-config-bulk branch 6 times, most recently from c7f9560 to 2649e0a Compare July 28, 2026 08:38
* @throws IllegalArgumentException if the provided options are invalid for the pipeline.
*/
@VisibleForTesting
static void validateOptions(

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 points.

  1. This looks very very similar to the previous method, why is this created as a different method here ? It would be better to just tweak the existing method for this extra parameter to keep the amount of change less ?
  2. As this is PG specific code, it should ideally go into the source directory and be exposed via the src connector. Please check if that is feasible here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Have added the TO-DO and moved the method.

() ->
CassandraIOWrapperHelper.buildDataSource(
TEST_BUCKET_CASSANDRA_CONFIG_CONF,
null,

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.

It doesn't seem like there is a test with this TEST_BUCKET_CASSANDRA_CONFIG_CONF config ? Can you double check ?

.oss()
.numPartitions())
.isEqualTo(42);
assertThrows(

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.

Is there an alternate test for invalid config url ?

ResourceManagerUtils.cleanResources(spannerResourceManager, mySQLResourceManager);
}

/**

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.

is this comment not relevant anymore ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, SHARD Id is populated. See expected data at line 106

shard.setLogicalShardId("Shard1");
shard.setUser(jdbcResourceManager.getUsername());
shard.setPassword(jdbcResourceManager.getPassword());
if (jdbcResourceManager instanceof PostgresResourceManager pgRm) {

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.

please check if the test cleanup scripts will handle these directories

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We are not creating any new folder here. This uses the run-id folder used by all other files.
protected String getGcsPath(String artifactId) {
return ArtifactUtils.getFullGcsPath(
artifactBucketName, getClass().getSimpleName(), gcsClient.runId(), artifactId);
}


JdbcShardConfig jdbcConfig = new JdbcShardConfig();
Shard shard1 = new Shard();
shard1.setNamespace("public");

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.

do we have a test for non-public namespaces as well ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This current test is testing non-public name space (line:155),

At line:166 only public name space is getting tested.

@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

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/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants