Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
real fix

re-fill connpool after removing an errored conn

fill stop log without explicit error : debug only

simpler
  • Loading branch information
glutamatt committed Sep 9, 2024
1 parent 3418a09 commit 5de89f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions connectionpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,9 @@ func (pool *hostConnPool) fillingStopped(err error) {

// if we errored and the size is now zero, make sure the host is marked as down
// see https://github.com/gocql/gocql/issues/1614
pool.logger.Printf("gocql: conns of pool after stopped %q: %v", host.ConnectAddress(), count)
if gocqlDebug {
pool.logger.Printf("gocql: conns of pool after stopped %q: %v", host.ConnectAddress(), count)
}

if err != nil && count == 0 {
if pool.session.cfg.ConvictionPolicy.AddFailure(err, host) {
Expand Down Expand Up @@ -585,9 +587,8 @@ func (pool *hostConnPool) HandleError(conn *Conn, err error, closed bool) {
return
}

if gocqlDebug {
pool.logger.Printf("gocql: pool connection error %q: %v\n", conn.addr, err)
}
pool.logger.Printf("gocql: removing failed pool connection to %q from connPicker: %v", conn.addr, err)

pool.connPicker.Remove(conn)
go pool.fill()
}
3 changes: 2 additions & 1 deletion connpicker.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ func (p *defaultConnPicker) Remove(conn *Conn) {

for i, candidate := range p.conns {
if candidate == conn {
p.conns[i] = nil
copy(p.conns[i:], p.conns[i+1:])
p.conns = p.conns[:len(p.conns)-1]
return
}
}
Expand Down

0 comments on commit 5de89f9

Please sign in to comment.