File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ import (
66)
77
88func MustDeleteTableOrQuerySession (err error ) bool {
9+ // Context errors (context.Canceled, context.DeadlineExceeded) indicate that a
10+ // query may still be running on the server side. The session must be invalidated
11+ // to prevent SESSION_BUSY errors on subsequent requests.
12+ if IsContextError (err ) {
13+ return true
14+ }
15+
916 if IsOperationError (err ,
1017 Ydb .StatusIds_BAD_SESSION ,
1118 Ydb .StatusIds_SESSION_BUSY ,
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ import (
1717func TestMustDeleteTableOrQuerySession (t * testing.T ) {
1818 t .Run ("True" , func (t * testing.T ) {
1919 for _ , err := range []error {
20+ context .Canceled ,
21+ context .DeadlineExceeded ,
2022 Transport (
2123 //nolint:staticcheck
2224 // ignore SA1019
@@ -63,8 +65,6 @@ func TestMustDeleteTableOrQuerySession(t *testing.T) {
6365 t .Run ("False" , func (t * testing.T ) {
6466 for _ , err := range []error {
6567 fmt .Errorf ("unknown error" ), // retryer given unknown error - we will not operationStatus and will close session
66- context .DeadlineExceeded ,
67- context .Canceled ,
6868 Transport (grpcStatus .Error (grpcCodes .ResourceExhausted , "" )),
6969 Transport (grpcStatus .Error (grpcCodes .OutOfRange , "" )),
7070 Operation (
You can’t perform that action at this time.
0 commit comments