Skip to content
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

fix(bigtable): Fix deadline exceeded conformance test #9220

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions bigtable/bigtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,27 @@ func (t *Table) ReadRows(ctx context.Context, arg RowSet, f func(Row) bool, opts
return err
}, retryOptions...)

// Convert error to grpc status error
bhshkh marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
if errStatus, ok := status.FromError(err); ok {
return status.Error(errStatus.Code(), errStatus.Message())
}

ctxStatus := status.FromContextError(err)
if ctxStatus.Code() != codes.Unknown {
return status.Error(ctxStatus.Code(), ctxStatus.Message())
}
}

return err
}

// ReadRow is a convenience implementation of a single-row reader.
// A missing row will return nil for both Row and error.
func (t *Table) ReadRow(ctx context.Context, row string, opts ...ReadOption) (Row, error) {
var r Row

opts = append([]ReadOption{LimitRows(1)}, opts...)
err := t.ReadRows(ctx, SingleRow(row), func(rr Row) bool {
r = rr
return true
Expand Down
Loading