Skip to content

Conversation

@bharadwaj-aditya
Copy link
Contributor

@bharadwaj-aditya bharadwaj-aditya commented Dec 15, 2025

Change the CPU priority in the Reverse replication flows to use what is configured in the template.
This PR specifically handles the change in the assign ShardId function. The other flow in Spanner DAO has been removed as the method was not being used.

@gemini-code-assist
Copy link

Summary of Changes

Hello @bharadwaj-aditya, 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 enhances the Spanner data access layer within the spanner-to-sourcedb template by modernizing the read operations. The changes ensure that Spanner reads explicitly leverage RPC priority settings for improved performance and resource allocation, while also updating the underlying API calls to use read with ResultSet for more robust and consistent data handling. This improves the overall reliability and configurability of Spanner interactions.

Highlights

  • Spanner Read API Update: Refactored Spanner data retrieval methods from readRow to the more flexible read API in both SpannerDao and AssignShardIdFn.
  • RPC Priority Integration: Implemented the use of Options.priority to apply configured RPC priority settings to Spanner read operations, ensuring better resource management and performance.
  • Result Set Handling: Adjusted the logic for processing Spanner read results to correctly handle ResultSet objects, including checking for rs.next() and extracting Struct via rs.getCurrentRowAsStruct().
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 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 counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@pull-request-size pull-request-size bot added size/M and removed size/S labels Dec 15, 2025
@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 15, 2025
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.48%. Comparing base (f48580d) to head (b6d6746).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...eport/v2/templates/transforms/AssignShardIdFn.java 81.81% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3110      +/-   ##
============================================
+ Coverage     50.39%   50.48%   +0.09%     
- Complexity     5021     5037      +16     
============================================
  Files           970      973       +3     
  Lines         59606    59716     +110     
  Branches       6507     6510       +3     
============================================
+ Hits          30039    30149     +110     
+ Misses        27441    27438       -3     
- Partials       2126     2129       +3     
Components Coverage Δ
spanner-templates 70.76% <66.03%> (+0.15%) ⬆️
spanner-import-export 68.99% <ø> (+0.12%) ⬆️
spanner-live-forward-migration 80.08% <0.00%> (+0.07%) ⬆️
spanner-live-reverse-replication 77.73% <68.62%> (+0.22%) ⬆️
spanner-bulk-migration 88.22% <0.00%> (-0.02%) ⬇️
Files with missing lines Coverage Δ
...t/v2/templates/dbutils/dao/spanner/SpannerDao.java 21.87% <100.00%> (-23.37%) ⬇️
...eport/v2/templates/transforms/AssignShardIdFn.java 78.14% <81.81%> (-1.09%) ⬇️

... and 17 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.

Copy link
Contributor

@sm745052 sm745052 left a comment

Choose a reason for hiding this comment

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

LGTM

@bharadwaj-aditya bharadwaj-aditya merged commit bf172e2 into GoogleCloudPlatform:main Dec 16, 2025
27 of 28 checks passed
aasthabharill pushed a commit to aasthabharill/DataflowTemplates that referenced this pull request Dec 17, 2025
* fixed priority handling in assign shrad id

* fixed tests

* fixed tests

* fixed tests

* moved result set to closeable block

---------

Co-authored-by: Aditya Bharadwaj <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants