googleapis / googleapis/google-cloud-go
spanner: examine test results for RequestIDHeader when environment variable GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS=true
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 1.6k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 109
Description
Reported to me offline by @rahul2393 and I ran tests to find failures due to the oddities which happen with multiplexed sessions and also seeming inconsistencies like only being enabled for ReadOnlyTransactions and pure WriteTransactions on main
```shell
$ GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS=true go test -short -run=.
2024/12/18 05:24:42 Integration tests skipped in -short mode.
--- FAIL: TestRequestIDHeader_onRetriesWithFailedTransactionCommit (0.01s)
request_id_header_test.go:494: unaryClientCall is incorrect; got=6 want=5
--- FAIL: TestRequestIDHeader_SingleUseReadOnly_ExecuteStreamingSql_Unavailable (0.02s)
request_id_header_test.go:1512: unaryClientCall is incorrect; got=2 want=1
request_id_header_test.go:1536: RequestID unary segments mismatch: got - want +
[]*spanner.requestIDSegments{
&{
... // 2 identical fields
ClientID: 54,
RequestNo: 1,
- ChannelID: 2,
+ ChannelID: 1,
RPCNo: 1,
},
- s"1.10766896037511722208.54.1.2.1",
}
--- FAIL: TestRequestIDHeader_SingleUseReadOnly_ExecuteStreamingSql_UnavailableDuringStream (0.05s)
request_id_header_test.go:1842: unaryClientCall is incorrect; got=2 want=1
request_id_header_test.go:1862: RequestID unary segments mismatch: got - want +
[]*spanner.requestIDSegments{
&{
... // 2 identical fields
ClientID: 49,
RequestNo: 1,
- ChannelID: 2,
+ ChannelID: 1,
RPCNo: 1,
},
- s"1.10766896037511722208.49.1.2.1",
}
--- FAIL: TestRequestIDHeader_BatchCreateSessions_Unavailable (0.01s)
request_id_header_test.go:1426: got 3 requests, want 4 requests:
got:
*spannerpb.CreateSessionRequest: database:"projects/[PROJECT]/instances/[INSTANCE]/databases/[DATABASE]" session:{multiplexed:true}]
*spannerpb.BatchCreateSessionsRequest: database:"projects/[PROJECT]/instances/[INSTANCE]/databases/[DATABASE]" session_template:{} session_count:2]
*spannerpb.ExecuteSqlRequest: session:"projects/[PROJECT]/instances/[INSTANCE]/databases/[DATABASE]/sessions/multiplexed-3" transaction:{single_use:{read_only:{strong:true return_read_timestamp:true}}} sql:"SELECT FOO FROM BAR" params:{} seqno:1 query_options:{} request_options:{}]
want:
*spannerpb.CreateSessionRequest: ]
*spannerpb.BatchCreateSessionsRequest: ]
*spannerpb.BatchCreateSessionsRequest: ]
*spannerpb.ExecuteSqlRequest: ]
--- FAIL: TestRequestIDHeader_ReadWriteTransactionUpdate (0.01s)
request_id_header_test.go:1098: unaryClientCall is incorrect; got=7 want=6
--- FAIL: TestRequestIDHeader_ReadWriteTransactionBatchUpdateWithOptions (0.02s)
request_id_header_test.go:1157: unaryClientCall is incorrect; got=5 want=4
--- FAIL: TestRequestIDHeader_ClientBatchWriteWithError (0.02s)
request_id_header_test.go:840: unaryClientCall is incorrect; got=2 want=1
--- FAIL: TestRequestIDHeader_PartitionQueryWithError (0.03s)
request_id_header_test.go:973: unaryClientCall is incorrect; got=5 want=4
--- FAIL: TestRequestIDHeader_clientBatchWrite (0.02s)
request_id_header_test.go:711: unaryClientCall is incorrect; got=2 want=1
--- FAIL: TestRequestIDHeader_ClientBatchWriteWithSessionNotFound (0.04s)
request_id_header_test.go:775: unaryClientCall is incorrect; got=2 want=1
--- FAIL: TestRequestIDHeader_PartitionQueryWithoutError (0.04s)
request_id_header_test.go:1015: unaryClientCall is incorrect; got=5 want=4
--- FAIL: TestRequestIDHeader_BatchDMLWithMultipleDML (0.03s)
request_id_header_test.go:653: unaryClientCall is incorrect; got=7 want=6
--- FAIL: TestRequestIDHeader_retriesOnSessionNotFound (0.04s)
request_id_header_test.go:573: unaryClientCall is incorrect; got=7 want=8
--- FAIL: TestRequestIDHeader_RetryOnAbortAndValidate (0.60s)
request_id_header_test.go:1351: unaryClientCall is incorrect; got=7 want=6
request_id_header_test.go:1376: RequestID segments mismatch: got - want +
[]*spanner.requestIDSegments{
&{
... // 2 identical fields
ClientID: 57,
RequestNo: 1,
- ChannelID: 2,
+ ChannelID: 1,
RPCNo: 1,
},
&{Version: 1, ProcessID: "10766896037511722208", ClientID: 57, RequestNo: 2, ...},
&{Version: 1, ProcessID: "10766896037511722208", ClientID: 57, RequestNo: 3, ...},
&{
Version: 1,
ProcessID: "10766896037511722208",
ClientID: 57,
- RequestNo: 4,
+ RequestNo: 3,
ChannelID: 1,
- RPCNo: 1,
+ RPCNo: 2,
},
&{
Version: 1,
ProcessID: "10766896037511722208",
ClientID: 57,
- RequestNo: 4,
+ RequestNo: 3,
ChannelID: 1,
- RPCNo: 2,
+ RPCNo: 3,
},
&{
Version: 1,
ProcessID: "10766896037511722208",
ClientID: 57,
- RequestNo: 4,
+ RequestNo: 3,
ChannelID: 1,
- RPCNo: 3,
+ RPCNo: 4,
},
- s"1.10766896037511722208.57.1.4.4",
}
FAIL
exit status 1
FAIL cloud.google.com/go/spanner 5.210s
```
## Remedies
- [x] Firstly don't block main with test failures by skipping request-id tests when the environment variable is set per PR https://github.com/googleapis/google-cloud-go/pull/11309
- [ ] Send a code patch to account for the oddities with multiplexed sessions
Contributor guide
Assessment
This issue has not been assessed yet.