This repository was archived by the owner on Apr 7, 2026. It is now read-only.
chore: add a random hint for multi-use transactions when they are use…#3058
Merged
arpan14 merged 5 commits intogoogleapis:mainfrom Apr 24, 2024
Merged
chore: add a random hint for multi-use transactions when they are use…#3058arpan14 merged 5 commits intogoogleapis:mainfrom
arpan14 merged 5 commits intogoogleapis:mainfrom
Conversation
…d with a multiplexed session.
olavloite
reviewed
Apr 24, 2024
| * <p>The below tests assert this behavior for both kinds of sessions. | ||
| */ | ||
| @RunWith(JUnit4.class) | ||
| public class TransactionChannelHintTest { |
Collaborator
There was a problem hiding this comment.
Can we combine this test with ChannelUsageTest? It seems that much of this test is a copy-paste from that test.
Contributor
Author
There was a problem hiding this comment.
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))); |
Collaborator
There was a problem hiding this comment.
If we decide to keep this test separate from ChannelUsageTest; can we remove the non-relevant parts for channel hints, such as this check?
olavloite
approved these changes
Apr 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.