Skip to content

chore: add a random hint for multi-use transactions when they are use… #3058

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

Merged
merged 5 commits into from
Apr 24, 2024

Conversation

arpan14
Copy link
Contributor

@arpan14 arpan14 commented Apr 22, 2024

Regular sessions maintain a channel hint per session at time of regular session creation. For each multi-use transaction, this hint is fetched from the session object and passed in the RPC. This hint helps to ensure, all RPCs within a multi-use transaction go to the same channel (and hence same SpanFE).

With multiplexed sessions, there is no channel hint being maintained with the session object. Hence, we need to store the hint with the transaction object and then pass it in the RPC methods.

@arpan14 arpan14 requested a review from a team as a code owner April 22, 2024 17:22
@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 Apr 22, 2024
@arpan14 arpan14 requested a review from olavloite April 22, 2024 17:32
@arpan14 arpan14 added the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 23, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 23, 2024
@arpan14 arpan14 requested a review from a team as a code owner April 23, 2024 06:13
* <p>The below tests assert this behavior for both kinds of sessions.
*/
@RunWith(JUnit4.class)
public class TransactionChannelHintTest {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we combine this test with ChannelUsageTest? It seems that much of this test is a copy-paste from that test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought it will be better to keep it separate. This class is to test whether a hint was passed or not. ChannelUsageTest focusses on channel creation/utilization.

In this class, we can expand it to all kinds of methods. Wheres the creation/utilization is sufficient to be tested for any 1 method (today - singleUse())

Comment on lines 124 to 128
assertEquals(
"gzip",
headers.get(
Metadata.Key.of(
"x-response-encoding", Metadata.ASCII_STRING_MARSHALLER)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we decide to keep this test separate from ChannelUsageTest; can we remove the non-relevant parts for channel hints, such as this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will do that

@arpan14 arpan14 requested a review from olavloite April 24, 2024 09:38
@arpan14 arpan14 added the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 24, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 24, 2024
@arpan14 arpan14 merged commit 7a53b75 into googleapis:main Apr 24, 2024
@arpan14 arpan14 deleted the mux-pr-random-hint branch April 26, 2024 19:47
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.

2 participants