Skip to content

Commit

Permalink
Avoid recreating gocql session on transient connection errors (#6207)
Browse files Browse the repository at this point in the history
## What changed?
Modifies gocql error handling introduced in
#4132 to avoid recreating the
gocql session on transient connection errors.

## Why?
Recreating the session adds latency and isn't necessary when connections
are closed or reset.

## How did you test it?
Ran a prod-like workload and periodically restarted cassandra nodes.
With the patch applied, we observed a reduction in p50 and p99 latency
across persistence operations. 

## Potential risks
No

## Is hotfix candidate?
No
  • Loading branch information
BenEddy committed Jul 1, 2024
1 parent 0a7b32d commit dd09320
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"context"
"sync"
"sync/atomic"
"syscall"
"time"

"github.com/gocql/gocql"
Expand Down Expand Up @@ -203,9 +202,7 @@ func (s *session) handleError(
) {
switch err {
case gocql.ErrNoConnections,
gocql.ErrSessionClosed,
gocql.ErrConnectionClosed,
syscall.ECONNRESET:
gocql.ErrSessionClosed:
s.refresh()
default:
// noop
Expand Down

0 comments on commit dd09320

Please sign in to comment.