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

Adds better error when there are timeouts in resource pools #7002

Merged
merged 1 commit into from
Nov 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions go/pools/resource_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,20 @@ import (
"vitess.io/vitess/go/sync2"
"vitess.io/vitess/go/timer"
"vitess.io/vitess/go/trace"
"vitess.io/vitess/go/vt/vterrors"

vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
)

var (
// ErrClosed is returned if ResourcePool is used when it's closed.
ErrClosed = errors.New("resource pool is closed")

// ErrTimeout is returned if a resource get times out.
ErrTimeout = errors.New("resource pool timed out")
ErrTimeout = vterrors.New(vtrpcpb.Code_DEADLINE_EXCEEDED, "resource pool timed out")

// ErrCtxTimeout is returned if a ctx is already expired by the time the resource pool is used
ErrCtxTimeout = errors.New("resource pool context already expired")
ErrCtxTimeout = vterrors.New(vtrpcpb.Code_DEADLINE_EXCEEDED, "resource pool context already expired")

prefillTimeout = 30 * time.Second
)
Expand Down