From b5c48da806cc5fcb42b25693fb36ae260ae17690 Mon Sep 17 00:00:00 2001 From: Jamie Scheinblum Date: Tue, 7 Nov 2023 07:17:19 -0800 Subject: [PATCH] fix bugs --- go/vt/vtgateproxy/gate_balancer.go | 2 +- go/vt/vtgateproxy/vtgateproxy.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go/vt/vtgateproxy/gate_balancer.go b/go/vt/vtgateproxy/gate_balancer.go index 494df3b0578..77f8de98c19 100644 --- a/go/vt/vtgateproxy/gate_balancer.go +++ b/go/vt/vtgateproxy/gate_balancer.go @@ -110,7 +110,7 @@ func (p *slackAZAffinityPicker) Pick(info balancer.PickInfo) (balancer.PickResul ptr := val.(*uint32) atomic.AddUint32(ptr, 1) - if len(subConns) >= numConnections { + if len(subConns) >= numConnections && numConnections > 0 { fmt.Printf("Limiting to first %v\n", numConnections) return p.pickFromSubconns(subConns[0:numConnections], *ptr) } else { diff --git a/go/vt/vtgateproxy/vtgateproxy.go b/go/vt/vtgateproxy/vtgateproxy.go index 86f88ce1644..ed5d1b266f5 100644 --- a/go/vt/vtgateproxy/vtgateproxy.go +++ b/go/vt/vtgateproxy/vtgateproxy.go @@ -68,7 +68,7 @@ func (proxy *VTGateProxy) getConnection(ctx context.Context, target string) (*vt proxy.numConnections = targetURL.Query().Get("num_connections") proxy.gateType = targetURL.Host - fmt.Printf("Getting connection for %v in %v\n", target, proxy.azID) + fmt.Printf("Getting connection for %v in %v with %v connections\n", target, proxy.azID, proxy.numConnections) // If the connection exists, return it proxy.mu.Lock()