From 0166c89a408f74de5672d94cb1b42b8ed773075e Mon Sep 17 00:00:00 2001 From: aquarapid Date: Fri, 2 Feb 2024 02:16:19 -0800 Subject: [PATCH] Make tablet collation mismatch warning throttled (#4282) Signed-off-by: Jacques Grove Signed-off-by: Vicent Marti --- go/vt/vtgate/tabletgateway.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go/vt/vtgate/tabletgateway.go b/go/vt/vtgate/tabletgateway.go index d1846168a43..b289cf3b74e 100644 --- a/go/vt/vtgate/tabletgateway.go +++ b/go/vt/vtgate/tabletgateway.go @@ -31,6 +31,7 @@ import ( "vitess.io/vitess/go/mysql/collations" "vitess.io/vitess/go/vt/discovery" "vitess.io/vitess/go/vt/log" + "vitess.io/vitess/go/vt/logutil" "vitess.io/vitess/go/vt/servenv" "vitess.io/vitess/go/vt/srvtopo" "vitess.io/vitess/go/vt/topo" @@ -52,6 +53,8 @@ var ( initialTabletTimeout = 30 * time.Second // retryCount is the number of times a query will be retried on error retryCount = 2 + + logCollations = logutil.NewThrottledLogger("CollationInconsistent", 1*time.Minute) ) func init() { @@ -435,7 +438,7 @@ func (gw *TabletGateway) updateDefaultConnCollation(tablet *topodatapb.Tablet) { return } if gw.defaultConnCollation.Load() != tablet.DefaultConnCollation { - log.Warning("this Vitess cluster has tablets with different default connection collations") + logCollations.Warningf("this Vitess cluster has tablets with different default connection collations") } }