Skip to content

perf(spanner): use passthrough with emulator endpoint#10947

Merged
rahul2393 merged 2 commits intomainfrom
fix-spanner-emulator
Oct 3, 2024
Merged

perf(spanner): use passthrough with emulator endpoint#10947
rahul2393 merged 2 commits intomainfrom
fix-spanner-emulator

Conversation

@rahul2393
Copy link
Copy Markdown
Contributor

Fixes: #10927

@rahul2393 rahul2393 requested review from a team October 3, 2024 10:19
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Oct 3, 2024
@rahul2393 rahul2393 enabled auto-merge (squash) October 3, 2024 10:19
@rahul2393 rahul2393 requested a review from olavloite October 3, 2024 10:27
Copy link
Copy Markdown
Contributor

@olavloite olavloite left a comment

Choose a reason for hiding this comment

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

LGTM

Side note: Is this something that also affects our tests using the mocked Spanner server? That also just uses a plain-text localhost connection.

@rahul2393 rahul2393 merged commit 9e964dd into main Oct 3, 2024
@rahul2393 rahul2393 deleted the fix-spanner-emulator branch October 3, 2024 11:43
@bhshkh bhshkh added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Oct 8, 2024
bhshkh added a commit that referenced this pull request Jan 28, 2026
Fixes #10965

This change updates the Bigtable client to use the `passthrough:///`
scheme when connecting to the emulator via `BIGTABLE_EMULATOR_HOST`.

This ensures consistent behavior with other Google Cloud Go clients
(e.g., Spanner #10947)
and avoids potential gRPC name resolution issues by forcing the
passthrough resolver. It handles `BIGTABLE_EMULATOR_HOST` values with or
without an existing scheme (e.g. `localhost:9000` or
`http://localhost:9000`).
apstndb added a commit to apstndb/spanemuboost that referenced this pull request Mar 7, 2026
…gsValidation

Without SPANNER_EMULATOR_HOST set, the Spanner client library doesn't add
the passthrough:/// prefix or skip dial settings validation. This causes
~100x slowdown (~1s per client creation) because the new authentication
library hits a slow auth path. Since spanemuboost connects via emu.URI()
without setting the env var, the fix from googleapis/google-cloud-go#10947
was being bypassed.

Add passthrough:/// prefix to endpoint and internaloption.SkipDialSettingsValidation()
to both ClientOptions() and defaultClientOpts().

Fixes #7

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
apstndb added a commit to apstndb/spanemuboost that referenced this pull request Mar 7, 2026
)

Without SPANNER_EMULATOR_HOST set, the Spanner client library doesn't add
the passthrough:/// prefix or skip dial settings validation. Since spanemuboost
connects via emu.URI() without setting the env var, the fix from
googleapis/google-cloud-go#10947 is bypassed.

Currently the auth layer uses grpc.DialContext (passthrough by default), so
this is not actively triggered, but it will regress when the auth layer
migrates to grpc.NewClient (dns resolver by default).

Changes:
- Add passthrough:/// prefix to endpoint in defaultClientOpts()
- Add internaloption.SkipDialSettingsValidation() (required by passthrough:///)
- Delegate Emulator.ClientOptions() to defaultClientOpts() to avoid duplication
- Update test assertion from 3 to 4 options

This aligns with the pattern used by Spanner, Bigtable, and Datastore SDKs
for their emulator paths.

Fixes #7

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the Spanner API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auth: Significant performance degradation with new authentication library in Spanner client (100x slower)

3 participants