Skip to content

Commit

Permalink
set query session status from error on execute
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Jan 27, 2025
1 parent 2fd3c4e commit d63e923
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/table/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type (
}
queryExecutor struct {
client Ydb_Query_V1.QueryServiceClient
core query.Core
}
)

Expand Down Expand Up @@ -210,6 +211,15 @@ func (e queryExecutor) executeDataQuery(

stream, err := e.client.ExecuteQuery(ctx, request, callOptions...)
if err != nil {
switch {
case xerrors.IsTransportError(err):
e.core.SetStatus(query.StatusError)
case xerrors.IsOperationError(err, Ydb.StatusIds_SESSION_BUSY, Ydb.StatusIds_BAD_SESSION):
e.core.SetStatus(query.StatusError)
case xerrors.IsOperationError(err, Ydb.StatusIds_BAD_SESSION):
e.core.SetStatus(query.StatusClosed)
}

return nil, nil, xerrors.WithStackTrace(err)
}

Expand Down Expand Up @@ -431,6 +441,7 @@ func newQuerySession(ctx context.Context, cc grpc.ClientConnInterface, config *c
},
}
s.executor = queryExecutor{
core: core,
client: core.Client,
}

Expand Down

0 comments on commit d63e923

Please sign in to comment.