Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(spanner): add support of multiplexed session support in writeAtleastOnce mutations #10646

Merged
merged 4 commits into from
Aug 7, 2024

Conversation

rahul2393
Copy link
Contributor

@rahul2393 rahul2393 commented Aug 7, 2024

  • This PR add support of using Multiplexed session if enabled with client.Apply(context.Background(), {mutations}, spanner.ApplyAtLeastOnce())

@rahul2393 rahul2393 requested review from a team as code owners August 7, 2024 06:37
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Aug 7, 2024
@rahul2393 rahul2393 changed the title feat(spanner): add support of multiplexed session support in mutations feat(spanner): add support of multiplexed session support in writeAtleastOnce mutations Aug 7, 2024
@@ -1890,7 +1890,7 @@ func (t *writeOnlyTransaction) applyAtLeastOnce(ctx context.Context, ms ...*Muta
for {
if sh == nil || sh.getID() == "" || sh.getClient() == nil {
// No usable session for doing the commit, take one from pool.
sh, err = t.sp.take(ctx)
sh, err = t.sp.takeMultiplexed(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume that it falls back to regular sessions in case there is an issue with multiplexed sessions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it will fallback to regular session, that logic is handled in takeMultiplexed because that behaviour is common

@harshachinta
Copy link
Contributor

harshachinta commented Aug 7, 2024

LGTM.
We are not adding a new environment variable to support multiplexed sessions in blind writes and instead when GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS is enabled it will automatically support blind writes also.

@rahul2393
Copy link
Contributor Author

LGTM.
One quick thought. I don't think we need a different environment variable to support multiplexed sessions in blind writes and instead when GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS is enabled it will automatically support blind writes also.

We are not using different env var

@rahul2393 rahul2393 merged commit 54009ea into main Aug 7, 2024
9 checks passed
@rahul2393 rahul2393 deleted the add_blind_write_mux_support branch August 7, 2024 10:28
gcf-merge-on-green bot pushed a commit that referenced this pull request Aug 7, 2024
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.

2 participants