Repository navigation
test(spanner): unflake ITSqlMusicScriptTest - #14814
Conversation
KeyAwareChannel incorrectly attached routing hints to ExecuteSqlRequest calls inside Partitioned DML transactions when pinned to an affinity endpoint. The fix tracks Partitioned DML transaction IDs from BeginTransaction options so routeFromRequest(ExecuteSqlRequest) skips attaching routing hints for Partitioned DML queries.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request ensures that routing hints are never attached to Partitioned DML requests in KeyAwareChannel. It introduces a cache to track Partitioned DML transaction IDs and bypasses attaching routing hints for these transactions, routing them to the affinity or default endpoint instead. A unit test has been added to verify this behavior. I have no feedback to provide.
There was a problem hiding this comment.
Code Review
This pull request ensures that Partitioned DML transactions do not carry routing hints by introducing a cache to track Partitioned DML transaction IDs in KeyAwareChannel. Requests for these transactions are routed without a routing hint, preventing them from being executed on the fastpath which does not support Partitioned DML. A unit test has been added to verify this behavior. I have no feedback to provide on these changes.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request ensures that Partitioned DML transactions and operations bypass the KeyAwareChannel routing and affinity mechanisms, executing directly on the default channel. It achieves this by configuring the partitionedDmlStub with a ClientContext using the default transport channel and updating KeyAwareChannel to disable transaction affinity tracking when Partitioned DML options are present. Comprehensive unit and integration tests have been added to verify these changes. I have no additional feedback to provide as the implementation is clean and well-tested.
Problem
BeginTransactionRequestcalls withTransactionOptions.PartitionedDmlrecorded transaction affinity inKeyAwareChannel, leaking affinity entries for 10 minutes because Partitioned DML transactions are never committed or rolled back.ExecuteSqlandExecuteStreamingSqlcalls enteredKeyAwareChannelviapartitionedDmlStub, causingrouteFromRequest(ExecuteSqlRequest.Builder)to attach aRoutingHintand route the statement to the server fastpath, which rejects Partitioned DML transactions withINVALID_ARGUMENT: PartitionedDml Transactions may only be used to execute DML statements.Solution
GapicSpannerRpc'spartitionedDmlStubwith aClientContextbacked directly byKeyAwareChannel.defaultChannel()whenKeyAwareChannelis active so Partitioned DMLExecuteSqlandExecuteStreamingSqlrequests bypassKeyAwareChanneland always use the default channel without routing hints.KeyAwareChannelsoBeginTransactionRequestand inlineTransactionSelector.begincalls withTransactionOptions.PartitionedDmlsetshouldRecordTransactionAffinity = false.GapicSpannerRpcTestandKeyAwareChannelTestverifying that Partitioned DML requests bypassKeyAwareChanneland do not record transaction affinity.