Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

#### 2.0.0

- Driver closes connection when timeout occurs (CASSGO-87)
- Do not set beta protocol flag when using v5 (CASSGO-88)

#### 2.0.0-rc1
Expand Down
17 changes: 6 additions & 11 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ type Conn struct {
ctx context.Context
cancel context.CancelFunc

timeouts int64

logger StructuredLogger
}

Expand Down Expand Up @@ -753,12 +751,6 @@ func (c *Conn) releaseStream(call *callReq) {
}
}

func (c *Conn) handleTimeout() {
if atomic.AddInt64(&c.timeouts, 1) > 0 {
c.closeWithError(ErrTooManyTimeouts)
}
}

func (c *Conn) recvSegment(ctx context.Context) error {
var (
frame []byte
Expand Down Expand Up @@ -1339,7 +1331,6 @@ func (c *Conn) execInternal(ctx context.Context, req frameBuilder, tracer Tracer
close(call.timeout)
c.logger.Debug("Request timed out on connection.",
newLogFieldString("host_id", c.host.HostID()), newLogFieldIp("addr", c.host.ConnectAddress()))
c.handleTimeout()
return nil, ErrTimeoutNoResponse
case <-ctxDone:
c.logger.Debug("Request failed because context elapsed out on connection.",
Expand Down Expand Up @@ -2004,9 +1995,13 @@ func (c *Conn) awaitSchemaAgreement(ctx context.Context) (err error) {
}

var (
ErrQueryArgLength = errors.New("gocql: query argument length mismatch")
ErrTimeoutNoResponse = errors.New("gocql: no response received from cassandra within timeout period")
ErrTooManyTimeouts = errors.New("gocql: too many query timeouts on the connection")
ErrConnectionClosed = errors.New("gocql: connection closed waiting for response")
ErrNoStreams = errors.New("gocql: no streams available on connection")

// Deprecated: TimeoutLimit was removed so this is never returned by the driver now
ErrTooManyTimeouts = errors.New("gocql: too many query timeouts on the connection")

// Deprecated: Never returned by the driver
ErrQueryArgLength = errors.New("gocql: query argument length mismatch")
Comment on lines +2002 to +2006
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good decision to leave this so not to break existing code bases if they rely on these errors 👍

)