From 46155c337f7303dd84521bb3558eaa8d726d0294 Mon Sep 17 00:00:00 2001 From: "Eduardo J. Ortega U." <5791035+ejortegau@users.noreply.github.com> Date: Wed, 18 Dec 2024 15:57:47 +0100 Subject: [PATCH] Fix TxThrottler init healtcheck args Signed-off-by: Eduardo J. Ortega U. <5791035+ejortegau@users.noreply.github.com> --- .../vttablet/tabletserver/txthrottler/tx_throttler.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go b/go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go index bd0d1cc5f52..2413c13718d 100644 --- a/go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go +++ b/go/vt/vttablet/tabletserver/txthrottler/tx_throttler.go @@ -329,10 +329,11 @@ func newTxThrottlerState(txThrottler *txThrottler, config *tabletenv.TabletConfi return state, nil } - func (ts *txThrottlerStateImpl) initHealthCheck(topoServer *topo.Server, target *querypb.Target) (err error) { ts.healthCheck, err = healthCheckFactory(ts.ctx, topoServer, target.Cell, target.Keyspace, target.Shard, ts.healthCheckCells) if err != nil { + ts.healthCheck = nil + return err } @@ -391,7 +392,13 @@ func (ts *txThrottlerStateImpl) healthChecksProcessor(topoServer *topo.Server, t } func (ts *txThrottlerStateImpl) makePrimary() { - ts.initHealthCheck() + err := ts.initHealthCheck(ts.txThrottler.topoServer, ts.target) + if err != nil { + log.Errorf("txThrottler: failed to initialize health check while attempting to make primary: %v", err) + + return + } + var ctx context.Context ctx, ts.healthCheckCancel = context.WithCancel(context.Background())