From 2f80169600c23787a25dd2a76c9bf225b85f47d7 Mon Sep 17 00:00:00 2001 From: "Eduardo J. Ortega U." <5791035+ejortegau@users.noreply.github.com> Date: Mon, 2 Dec 2024 14:20:10 +0100 Subject: [PATCH] Slack 15.0 vtgate log wait tgts (#569) This adds logging to healthcheck wait for tablet types so we know where it's stuck - if anywhere. Signed-off-by: Eduardo J. Ortega U. <5791035+ejortegau@users.noreply.github.com> --- go/vt/discovery/healthcheck.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/go/vt/discovery/healthcheck.go b/go/vt/discovery/healthcheck.go index 1a669f60faa..440737bd696 100644 --- a/go/vt/discovery/healthcheck.go +++ b/go/vt/discovery/healthcheck.go @@ -732,6 +732,10 @@ func (hc *HealthCheckImpl) WaitForAllServingTablets(ctx context.Context, targets // waitForTablets is the internal method that polls for tablets. func (hc *HealthCheckImpl) waitForTablets(ctx context.Context, targets []*query.Target, requireServing bool) error { + log.Infof("Starting wait for tablets loop...") + waitLogSoFar := 0 * time.Second + waitLogPeriod := 5 * time.Second + for { // We nil targets as we find them. allPresent := true @@ -770,6 +774,18 @@ func (hc *HealthCheckImpl) waitForTablets(ctx context.Context, targets []*query. } return ctx.Err() case <-timer.C: + waitLogSoFar += waitAvailableTabletInterval + if waitLogSoFar >= waitLogPeriod { + waitLogSoFar = 0 + var nonNilTargets = []query.Target{} + for _, target := range targets { + if target != nil { + nonNilTargets = append(nonNilTargets, query.Target{Keyspace: target.Keyspace, Shard: target.Shard, + TabletType: target.TabletType, Cell: target.Cell}) + } + } + log.Infof("Still waiting for targets %+v", nonNilTargets) + } } } }