Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

feat(spanner): add support for Multiplexed Session for Read Only Tran…#2214

Merged
alkatrivedi merged 36 commits intomainfrom
multiplexed-session-support-read-only
Feb 26, 2025
Merged

feat(spanner): add support for Multiplexed Session for Read Only Tran…#2214
alkatrivedi merged 36 commits intomainfrom
multiplexed-session-support-read-only

Conversation

@alkatrivedi
Copy link
Copy Markdown
Contributor

@alkatrivedi alkatrivedi commented Jan 9, 2025

This PR contains support for Multiplexed Session in all the RO methods, along with their tests.

The methods includes are:

  • getSnapshot
  • runStream
  • writeAtLeastOnce

To enable multiplexed session set the environment variable GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS to true

Note: if multiplexed session is enabled, database should exists before getting a reference to cloud spanner database
const database = instance.database(databaseId);

@alkatrivedi alkatrivedi requested review from a team January 9, 2025 05:10
@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. api: spanner Issues related to the googleapis/nodejs-spanner API. labels Jan 9, 2025
gcf-owl-bot bot and others added 4 commits January 9, 2025 05:15
* chore(main): release 7.17.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: surbhigarg92 <surbhigarg.92@gmail.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
@alkatrivedi alkatrivedi force-pushed the multiplexed-session-support-read-only branch 2 times, most recently from 8a256e0 to 7cf1d60 Compare January 9, 2025 05:26
@alkatrivedi alkatrivedi added the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 9, 2025
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 9, 2025
@alkatrivedi alkatrivedi force-pushed the multiplexed-session-support-read-only branch from 7cf1d60 to 9a85b93 Compare January 9, 2025 05:29
@alkatrivedi alkatrivedi added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 9, 2025
@alkatrivedi alkatrivedi force-pushed the multiplexed-session-support-read-only branch from 860bf28 to 47a9219 Compare January 9, 2025 06:14
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 9, 2025
@alkatrivedi alkatrivedi force-pushed the multiplexed-session-support-read-only branch from 47a9219 to 3a3d8c7 Compare January 9, 2025 06:41
@alkatrivedi alkatrivedi force-pushed the multiplexed-session-support-read-only branch from 3a3d8c7 to bc56399 Compare January 9, 2025 06:42
@alkatrivedi alkatrivedi force-pushed the multiplexed-session-support-read-only branch from bc56399 to f477940 Compare January 9, 2025 06:43
@alkatrivedi alkatrivedi added the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 9, 2025
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 9, 2025
@alkatrivedi alkatrivedi force-pushed the multiplexed-session-support-read-only branch 6 times, most recently from 1e73e06 to 9b092ef Compare January 23, 2025 06:12
@alkatrivedi alkatrivedi added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 23, 2025
Copy link
Copy Markdown
Contributor

@surbhigarg92 surbhigarg92 left a comment

Choose a reason for hiding this comment

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

Please share benchmarking results before merging


'use strict';

const muxEnabledTrue = [];
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.

nit: I don't think you need to maintain two arrays here. You will either call this script with multiplexedEnabled as true or false. So only one will be used.

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.

yeah, updated

}

async function runQueries() {
multiplexedEnabled === 'true'
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.

Every thread is creating new Spanner instance, that would mean it will create a new mux session. So eventually we are running only one query at a time for one spanner client.

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.

thanks for pointing this out, updated the client creation

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: spanner Issues related to the googleapis/nodejs-spanner API. size: xl Pull request size is extra large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants