Repository navigation
[Java] Support cross-project metadata databases in SpannerIO.readChangeStream - #41880
sakshammalik260-cse wants to merge 1 commit into
Conversation
Add an optional metadata project override while preserving existing metadata configuration policies and default behavior. Generated-by: OpenAI Codex
|
/gemini review |
There was a problem hiding this comment.
📋 Review Summary
This PR adds support for configuring a separate GCP project for the change stream partition metadata database via SpannerIO.ReadChangeStream.withMetadataProjectId(String) (closing #41863). The implementation cleanly delegates project override logic to MetadataSpannerConfigFactory.create, preserves backward compatibility when unset or cleared, and includes comprehensive unit tests.
🔍 General Feedback
- The changes to
SpannerIO,MetadataSpannerConfigFactory, andSpannerIOReadChangeStreamTestare well-structured, adhere to existingAutoValueandSpannerConfigconventions, and properly handle dialect resolution and DAO routing across projects.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
|
Hi @scwhittle, could you please review this PR when you have a chance? It addresses #41863 by adding optional cross-project metadata database support while preserving the existing metadata configuration policy and backward compatibility. All 84 targeted local unit tests and quality checks passed. The initial Gemini review was also positive. The official CI workflows are currently awaiting approval. I'd appreciate your feedback. Thank you! |
|
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
|
assign set of reviewers |
|
Assigning reviewers: R: @nielm for label spanner. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
| assertEquals("metadata-project", copy.getMetadataProjectId()); | ||
| SpannerConfig metadata = | ||
| assertRouting( | ||
| configured, "metadata-project", TEST_METADATA_INSTANCE, TEST_METADATA_DATABASE); |
There was a problem hiding this comment.
assertRouting(
copy, "metadata-project", TEST_METADATA_INSTANCE, TEST_METADATA_DATABASE); ?
| * <p>The metadata instance and database still default to the source instance and database | ||
| * names, interpreted in this project. Access requires permissions to read and write metadata | ||
| * and update its schema in the metadata database. This does not change the source | ||
| * configuration. |
There was a problem hiding this comment.
If the user specifies an instance, we require setting the database.
If user specifies the project, to be consistent we should also require instance and database.
Summary
Closes #41863.
Adds an optional
withMetadataProjectId()configuration method toSpannerIO.ReadChangeStream, allowing change-stream metadata to be stored in a Google Cloud Spanner database in a different project from the source database.Problem
Currently, the metadata configuration always inherits the source database's project ID. Users managing databases across multiple GCP projects cannot configure a centralized metadata database in a separate project.
Solution
withMetadataProjectId(String)through the existing immutable AutoValue builder.MetadataSpannerConfigFactoryconfiguration policy.No new production dependencies, additional network requests, or per-record processing are introduced.
Usage
Testing and Validation
84 targeted local unit tests passed with zero failures or skips.
Regression coverage includes:
Controlled mutation testing confirmed that the regression tests detect swapped dialect configurations, missing project overrides, and incorrectly delayed project overrides.
The following quality checks passed:
git diff --check.Live cross-project Spanner and IAM integration testing was not performed.