diff --git a/go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go b/go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go index 18dede5f30a..e14ed5c6adf 100644 --- a/go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go +++ b/go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go @@ -150,7 +150,6 @@ type txThrottler struct { // stats throttlerRunning *stats.Gauge - topoWatchers *stats.GaugesWithSingleLabel healthChecksReadTotal *stats.CountersWithMultiLabels healthChecksRecordedTotal *stats.CountersWithMultiLabels requestsTotal *stats.CountersWithSingleLabel @@ -204,7 +203,6 @@ func NewTxThrottler(env tabletenv.Env, topoServer *topo.Server) TxThrottler { config: config, topoServer: topoServer, throttlerRunning: env.Exporter().NewGauge(TxThrottlerName+"Running", "transaction throttler running state"), - topoWatchers: env.Exporter().NewGaugesWithSingleLabel(TxThrottlerName+"TopoWatchers", "transaction throttler topology watchers", "cell"), healthChecksReadTotal: env.Exporter().NewCountersWithMultiLabels(TxThrottlerName+"HealthchecksRead", "transaction throttler healthchecks read", []string{"cell", "DbType"}), healthChecksRecordedTotal: env.Exporter().NewCountersWithMultiLabels(TxThrottlerName+"HealthchecksRecorded", "transaction throttler healthchecks recorded", @@ -334,7 +332,6 @@ func (ts *txThrottlerStateImpl) initHealthCheckStream(topoServer *topo.Server, t discovery.DefaultTopologyWatcherRefreshInterval, discovery.DefaultTopoReadConcurrency, ) - ts.txThrottler.topoWatchers.Add(cell, 1) } } @@ -342,9 +339,8 @@ func (ts *txThrottlerStateImpl) closeHealthCheckStream() { if ts.healthCheck == nil { return } - for cell, watcher := range ts.topologyWatchers { + for _, watcher := range ts.topologyWatchers { watcher.Stop() - ts.txThrottler.topoWatchers.Reset(cell) } ts.topologyWatchers = nil ts.stopHealthCheck() diff --git a/go/vt/vttablet/tabletserver/txthrottler/tx_throttler_test.go b/go/vt/vttablet/tabletserver/txthrottler/tx_throttler_test.go index ea57d37ad8e..61c408cc1f9 100644 --- a/go/vt/vttablet/tabletserver/txthrottler/tx_throttler_test.go +++ b/go/vt/vttablet/tabletserver/txthrottler/tx_throttler_test.go @@ -131,7 +131,6 @@ func TestEnabledThrottler(t *testing.T) { throttlerStateImpl := throttlerImpl.state.(*txThrottlerStateImpl) assert.Equal(t, map[topodatapb.TabletType]bool{topodatapb.TabletType_REPLICA: true}, throttlerStateImpl.tabletTypes) assert.Equal(t, int64(1), throttlerImpl.throttlerRunning.Get()) - assert.Equal(t, map[string]int64{"cell1": 1, "cell2": 1}, throttlerImpl.topoWatchers.Counts()) assert.False(t, throttlerImpl.Throttle(100, "some_workload")) assert.Equal(t, int64(1), throttlerImpl.requestsTotal.Counts()["some_workload"]) @@ -162,7 +161,6 @@ func TestEnabledThrottler(t *testing.T) { assert.Equal(t, int64(1), throttlerImpl.requestsThrottled.Counts()["some_workload"]) throttlerImpl.Close() assert.Zero(t, throttlerImpl.throttlerRunning.Get()) - assert.Equal(t, map[string]int64{"cell1": 0, "cell2": 0}, throttlerImpl.topoWatchers.Counts()) } func TestFetchKnownCells(t *testing.T) {