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: Leader Aware Routing #2214

Merged
merged 13 commits into from Apr 28, 2023
Merged

feat: Leader Aware Routing #2214

merged 13 commits into from Apr 28, 2023

Conversation

yifanzyifanz
Copy link
Contributor

@yifanzyifanz yifanzyifanz commented Dec 29, 2022

Add x-goog-spanner-route-to-leader header to Spanner RPC contexts for RW/PDML transactions.

The header is added to support leader-aware-routing feature, which aims at reducing cross-regional latency for RW/PDML transactions in a multi-region instance.

This feature is off by default and can be enabled by enabling Leader Aware Routing while creating Spanner object.

Spanner spanner = SpannerOptions.newBuilder().enableLeaderAwareRouting().build().getService();

@yifanzyifanz yifanzyifanz requested a review from a team as a code owner December 29, 2022 23:55
@conventional-commit-lint-gcf
Copy link

conventional-commit-lint-gcf bot commented Dec 29, 2022

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: spanner Issues related to the googleapis/java-spanner API. labels Dec 29, 2022
@yifanzyifanz yifanzyifanz changed the title Add x-goog-spanner-route-to-leader header to Spanner RPC contexts f… feat: Add x-goog-spanner-route-to-leader header to Spanner RPC contexts f… Dec 29, 2022
…exts for RW/PDML transactions.

The header is added to support leader-aware-routing feature, which aims at reducing cross-regional latency for RW/PDML transactions in a multi-region instance.
@yifanzyifanz yifanzyifanz requested a review from a team as a code owner January 24, 2023 21:19
@rajatbhatta rajatbhatta added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 25, 2023
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 25, 2023
@yifanzyifanz yifanzyifanz requested review from rajatbhatta and removed request for rajatbhatta January 26, 2023 18:38
Copy link
Collaborator

@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, with a couple of nits.

Tip: You could add an extra verification to this test to verify that the header is really sent to Cloud Spanner:

@@ -275,7 +275,7 @@ public AsyncTransactionManagerImpl transactionManagerAsync(TransactionOption...
@Override
public void prepareReadWriteTransaction() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not relevant for this PR, but note to self/other readers: This seems like a method that can be cleaned up. I don't think it is in use anymore. @rajatbhatta Would you mind taking a look at that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, I'll take a look. @yifanzyifanz: Please keep this comment unresolved for the time being.

Copy link
Contributor

@rajatbhatta rajatbhatta left a comment

Choose a reason for hiding this comment

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

LGTM (apart from one of my pending comments and nits from @olavloite)

@@ -275,7 +275,7 @@ public AsyncTransactionManagerImpl transactionManagerAsync(TransactionOption...
@Override
public void prepareReadWriteTransaction() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, I'll take a look. @yifanzyifanz: Please keep this comment unresolved for the time being.

yifanzyifanz and others added 3 commits February 1, 2023 12:56
…eader header exists for RW transactions and does not exist for RO transactions or when the leader aware routing feature is disabled.
@rajatbhatta rajatbhatta added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 2, 2023
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 2, 2023
@rajatbhatta rajatbhatta added the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 3, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 3, 2023
@rajatbhatta rajatbhatta added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 3, 2023
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 3, 2023
@rajatbhatta rajatbhatta added the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 3, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 3, 2023
@rajatbhatta rajatbhatta added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Feb 3, 2023
Copy link
Contributor

@rajatbhatta rajatbhatta left a comment

Choose a reason for hiding this comment

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

Adding "Request changes" to prevent accidental merge of this PR. Note that the changes still look good to me.

@rajatbhatta rajatbhatta removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Apr 27, 2023
@rajatbhatta rajatbhatta changed the title feat: Add x-goog-spanner-route-to-leader header to Spanner RPC contexts f… feat: Leader Aware Routing Apr 27, 2023
@rajatbhatta
Copy link
Contributor

Changing the Title to make it consistent across clients.

@rajatbhatta rajatbhatta added the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 27, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 27, 2023
@rajatbhatta rajatbhatta added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 28, 2023
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 28, 2023
@rajatbhatta rajatbhatta merged commit 9695ace into googleapis:main Apr 28, 2023
24 checks passed
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 googleapis/java-spanner API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants