Skip to content

Commit

Permalink
add recycling logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mhamza15 committed Jan 29, 2025
1 parent 7d10c28 commit 75450ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go/pools/smartconnpool/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"context"
"sync/atomic"
"time"

"vitess.io/vitess/go/vt/log"
)

type Connection interface {
Expand All @@ -45,6 +47,7 @@ func (dbc *Pooled[C]) Close() {
}

func (dbc *Pooled[C]) Recycle() {
log.Errorf("========================== IM RECYCLING THE CONNECTION\nconn:\n%+v\npool:\n%+v", dbc, dbc.pool)
switch {
case dbc.pool == nil:
dbc.Conn.Close()
Expand Down
2 changes: 2 additions & 0 deletions go/vt/vttablet/tabletserver/query_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,12 +697,14 @@ func (qre *QueryExecutor) execSelect() (*sqltypes.Result, error) {
}
// Check tablet type.
if qre.shouldConsolidate() {
log.Error("============================== WE'RE CONSOLIDATING")
q, original := qre.tsv.qe.consolidator.Create(sqlWithoutComments)
if original {
defer q.Broadcast()
conn, err := qre.getConn()

if err != nil {
log.Errorf("=========================== ERROR WHEN TRYING TO GET CONNECTION WHEN CONSOLIDATING: %s", err)
q.SetErr(err)
} else {
defer conn.Recycle()
Expand Down

0 comments on commit 75450ef

Please sign in to comment.