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

debug/readreplica/grpc connection #2288

Merged
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
17 changes: 15 additions & 2 deletions internal/net/grpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,22 @@
}
})
cancel()
disconnected := make(map[string]bool, len(disconnectTargets))
var (
disconnectFlag bool
isIPv4, isIPv6 bool
host string
port uint16
disconnected = make(map[string]bool, len(disconnectTargets))
)

Check warning on line 338 in internal/net/grpc/client.go

View check run for this annotation

Codecov / codecov/patch

internal/net/grpc/client.go#L332-L338

Added lines #L332 - L338 were not covered by tests
for _, addr := range disconnectTargets {
if !disconnected[addr] {
host, port, _, isIPv4, isIPv6, err = net.Parse(addr)
disconnectFlag = isIPv4 || isIPv6 // Disconnect only if the connection is a direct IP connection; do not delete connections via DNS due to retry.
if err != nil {
log.Warnf("failed to parse addr %s for disconnection checking, will disconnect soon: host: %s, port %d, err: %v", addr, host, port, err)
disconnectFlag = true // Disconnect if the address connected to is not parseable.
}
if disconnectFlag &&
!disconnected[addr] {

Check warning on line 347 in internal/net/grpc/client.go

View check run for this annotation

Codecov / codecov/patch

internal/net/grpc/client.go#L340-L347

Added lines #L340 - L347 were not covered by tests
err = g.Disconnect(ctx, addr)
if err != nil {
if !errors.Is(err, context.Canceled) &&
Expand Down
6 changes: 3 additions & 3 deletions internal/net/grpc/pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
!errors.Is(ierr, context.Canceled) {
log.Warnf("An error occurred while dialing pool member connection to %s,\terror: %v", addr, ierr)
} else {
log.Debug("Connect loop operation canceled while dialing pool member connection to %s,\terror: %v", addr, ierr)
log.Debugf("Connect loop operation canceled while dialing pool member connection to %s,\terror: %v", addr, ierr)

Check warning on line 362 in internal/net/grpc/pool/pool.go

View check run for this annotation

Codecov / codecov/patch

internal/net/grpc/pool/pool.go#L362

Added line #L362 was not covered by tests
return false
}
}
Expand Down Expand Up @@ -421,7 +421,7 @@
}
return true
} else {
log.Debug("Connect loop operation canceled while dialing pool member connection to %s,\terror: %v", p.addr, ierr)
log.Debugf("Connect loop operation canceled while dialing pool member connection to %s,\terror: %v", p.addr, ierr)

Check warning on line 424 in internal/net/grpc/pool/pool.go

View check run for this annotation

Codecov / codecov/patch

internal/net/grpc/pool/pool.go#L424

Added line #L424 was not covered by tests
return false
}
}
Expand Down Expand Up @@ -449,7 +449,7 @@
log.Debugf("failed to close connection pool addr = %s\terror = %v", pc.addr, ierr)
emap[ierr.Error()] = err
} else {
log.Debug("Disconnect loop operation canceled while closing pool member connection to %s,\terror: %v", pc.addr, ierr)
log.Debugf("Disconnect loop operation canceled while closing pool member connection to %s,\terror: %v", pc.addr, ierr)

Check warning on line 452 in internal/net/grpc/pool/pool.go

View check run for this annotation

Codecov / codecov/patch

internal/net/grpc/pool/pool.go#L452

Added line #L452 was not covered by tests
return false
}
}
Expand Down
Loading