Skip to content

fix(Spanner): Segregate spanner instances for templates in load test. - #4136

Merged
pratickchokhani merged 1 commit into
GoogleCloudPlatform:mainfrom
pratickchokhani:segregate-instance
Aug 21, 2026
Merged

fix(Spanner): Segregate spanner instances for templates in load test.#4136
pratickchokhani merged 1 commit into
GoogleCloudPlatform:mainfrom
pratickchokhani:segregate-instance

Conversation

@pratickchokhani

@pratickchokhani pratickchokhani commented Aug 13, 2026

Copy link
Copy Markdown
Contributor
  • When spanner instances are randomly selected, then 2 load tests across templates can be assigned same instances.
  • This can cause the spanner instance to overload.
  • Hence, every template is assigned 1 spanner instance.

@pratickchokhani pratickchokhani added the bug Something isn't working label Aug 13, 2026
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.89%. Comparing base (14ff8d6) to head (7e55d5f).

Files with missing lines Patch % Lines
...he/beam/it/gcp/spanner/SpannerResourceManager.java 0.00% 6 Missing ⚠️

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@              Coverage Diff              @@
##               main    #4136       +/-   ##
=============================================
+ Coverage     33.89%   55.89%   +21.99%     
- Complexity      503     7475     +6972     
=============================================
  Files           215     1134      +919     
  Lines         13128    70126    +56998     
  Branches       1303     8012     +6709     
=============================================
+ Hits           4450    39197    +34747     
- Misses         8313    28383    +20070     
- Partials        365     2546     +2181     
Components Coverage Δ
spanner-templates 84.63% <ø> (∅)
spanner-import-export 68.92% <ø> (∅)
spanner-live-forward-migration 88.66% <ø> (∅)
spanner-live-reverse-replication 81.26% <ø> (∅)
spanner-bulk-migration 89.06% <ø> (∅)
gcs-spanner-dv 87.85% <ø> (∅)
Files with missing lines Coverage Δ
...he/beam/it/gcp/spanner/SpannerResourceManager.java 64.72% <0.00%> (-0.96%) ⬇️

... and 944 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 marked this pull request as ready for review August 13, 2026 14:01
@pratickchokhani
pratickchokhani requested a review from a team as a code owner August 13, 2026 14:01
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a mechanism to segregate Spanner instances across different load test templates. By allowing tests to specify an instance hint, the system can deterministically assign unique Spanner instances from the available pool, preventing resource contention and potential overloading that occurred when instances were selected randomly.

Highlights

  • Spanner Instance Segregation: Updated the Spanner resource manager to allow providing an optional instance hint, ensuring that different load test templates are assigned unique Spanner instances to prevent overloading.
  • Resource Manager API Update: Modified the maybeUseStaticInstance method to accept an Optional<Integer> hint, which is used to select a specific instance from the available pool via modulo arithmetic.
  • Load Test Configuration: Updated various load test base classes and implementations to pass specific instance hints, effectively segregating resources across different test suites.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates SpannerResourceManager to allow selecting a static Spanner instance deterministically by passing an optional instanceHint (as Optional<Integer>). It also updates various load-testing classes to use this new parameter. The reviewer suggests simplifying the API usage across all test files by allowing a primitive int to be passed directly instead of wrapping it in java.util.Optional.of(...).

@pratickchokhani
pratickchokhani force-pushed the segregate-instance branch 3 times, most recently from 2a3390a to 40c6fc2 Compare August 21, 2026 06:15

@darshan-sj darshan-sj 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.

Looks good

@pratickchokhani
pratickchokhani merged commit 621956e into GoogleCloudPlatform:main Aug 21, 2026
43 of 45 checks passed
@pratickchokhani
pratickchokhani deleted the segregate-instance branch August 21, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working bug-fix size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants