diff --git a/go/vt/vttablet/grpctabletconn/conn.go b/go/vt/vttablet/grpctabletconn/conn.go index 71aeec4aee8..a1d68d09738 100644 --- a/go/vt/vttablet/grpctabletconn/conn.go +++ b/go/vt/vttablet/grpctabletconn/conn.go @@ -29,6 +29,7 @@ import ( "vitess.io/vitess/go/sqltypes" "vitess.io/vitess/go/vt/callerid" "vitess.io/vitess/go/vt/grpcclient" + "vitess.io/vitess/go/vt/log" "vitess.io/vitess/go/vt/logutil" "vitess.io/vitess/go/vt/servenv" "vitess.io/vitess/go/vt/vttablet/queryservice" @@ -82,7 +83,7 @@ type gRPCQueryClient struct { c queryservicepb.QueryClient } -var logger = logutil.NewThrottledLogger("gRPCQueryClient", 50*time.Millisecond) +var throttledLogger = logutil.NewThrottledLogger("gRPCQueryClient", 50*time.Millisecond) var _ queryservice.QueryService = (*gRPCQueryClient)(nil) @@ -119,7 +120,7 @@ func (conn *gRPCQueryClient) Execute(ctx context.Context, target *querypb.Target conn.mu.RLock() defer conn.mu.RUnlock() if conn.cc == nil { - logger.Errorf("vttablet: Connection Closed (alias: %v, type: )", conn.tablet.Alias, conn.tablet.Type) + throttledLogger.Errorf("vttablet: Connection Closed (alias: %v, type: )", conn.tablet.Alias, conn.tablet.Type) return nil, tabletconn.ConnClosed } @@ -159,7 +160,7 @@ func (conn *gRPCQueryClient) StreamExecute(ctx context.Context, target *querypb. conn.mu.RLock() defer conn.mu.RUnlock() if conn.cc == nil { - logger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) + throttledLogger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) return nil, tabletconn.ConnClosed } @@ -428,7 +429,7 @@ func (conn *gRPCQueryClient) ReadTransaction(ctx context.Context, target *queryp conn.mu.RLock() defer conn.mu.RUnlock() if conn.cc == nil { - logger.Errorf("vttablet: Connection Closed (%v)", conn.tablet.Alias) + throttledLogger.Errorf("vttablet: Connection Closed (%v)", conn.tablet.Alias) return nil, tabletconn.ConnClosed } @@ -494,7 +495,7 @@ func (conn *gRPCQueryClient) BeginStreamExecute(ctx context.Context, target *que conn.mu.RLock() defer conn.mu.RUnlock() if conn.cc == nil { - logger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) + throttledLogger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) return nil, tabletconn.ConnClosed } @@ -567,7 +568,7 @@ func (conn *gRPCQueryClient) MessageStream(ctx context.Context, target *querypb. conn.mu.RLock() defer conn.mu.RUnlock() if conn.cc == nil { - logger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) + throttledLogger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) return nil, tabletconn.ConnClosed } @@ -635,7 +636,7 @@ func (conn *gRPCQueryClient) StreamHealth(ctx context.Context, callback func(*qu conn.mu.RLock() defer conn.mu.RUnlock() if conn.cc == nil { - logger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) + throttledLogger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) return nil, tabletconn.ConnClosed } @@ -671,7 +672,7 @@ func (conn *gRPCQueryClient) VStream(ctx context.Context, request *binlogdatapb. conn.mu.RLock() defer conn.mu.RUnlock() if conn.cc == nil { - logger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) + throttledLogger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) return nil, tabletconn.ConnClosed } @@ -720,7 +721,7 @@ func (conn *gRPCQueryClient) VStreamRows(ctx context.Context, request *binlogdat conn.mu.RLock() defer conn.mu.RUnlock() if conn.cc == nil { - logger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) + throttledLogger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) return nil, tabletconn.ConnClosed } @@ -766,7 +767,7 @@ func (conn *gRPCQueryClient) VStreamResults(ctx context.Context, target *querypb conn.mu.RLock() defer conn.mu.RUnlock() if conn.cc == nil { - logger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) + throttledLogger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) return nil, tabletconn.ConnClosed } @@ -855,7 +856,7 @@ func (conn *gRPCQueryClient) ReserveBeginStreamExecute(ctx context.Context, targ conn.mu.RLock() defer conn.mu.RUnlock() if conn.cc == nil { - logger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) + throttledLogger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) return nil, tabletconn.ConnClosed } @@ -970,7 +971,7 @@ func (conn *gRPCQueryClient) ReserveStreamExecute(ctx context.Context, target *q conn.mu.RLock() defer conn.mu.RUnlock() if conn.cc == nil { - logger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) + throttledLogger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) return nil, tabletconn.ConnClosed } @@ -1067,7 +1068,7 @@ func (conn *gRPCQueryClient) GetSchema(ctx context.Context, target *querypb.Targ conn.mu.RLock() defer conn.mu.RUnlock() if conn.cc == nil { - logger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) + throttledLogger.Errorf("vttablet: Connection Closed (%v)", conn.tablet) return nil, tabletconn.ConnClosed } @@ -1106,7 +1107,7 @@ func (conn *gRPCQueryClient) Close(ctx context.Context) error { return nil } - logger.Infof("vttablet: Closing Connection (%v)", conn.tablet) + log.Infof("vttablet: Closing Connection (%v)", conn.tablet) cc := conn.cc conn.cc = nil