-
Notifications
You must be signed in to change notification settings - Fork 132
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
Conversation
…d with a multiplexed session.
* <p>The below tests assert this behavior for both kinds of sessions. | ||
*/ | ||
@RunWith(JUnit4.class) | ||
public class TransactionChannelHintTest { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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())
assertEquals( | ||
"gzip", | ||
headers.get( | ||
Metadata.Key.of( | ||
"x-response-encoding", Metadata.ASCII_STRING_MARSHALLER))); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will do that
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.