From a82a8d1ff329643140e16adcd4b0e414925d91f0 Mon Sep 17 00:00:00 2001 From: "Eduardo J. Ortega U." <5791035+ejortegau@users.noreply.github.com> Date: Wed, 27 Nov 2024 10:21:13 +0100 Subject: [PATCH] Add logging to the healthcheck's waiting for targets Signed-off-by: Eduardo J. Ortega U. <5791035+ejortegau@users.noreply.github.com> --- go/vt/discovery/healthcheck.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/go/vt/discovery/healthcheck.go b/go/vt/discovery/healthcheck.go index 1a669f60faa..fcdec0b1af6 100644 --- a/go/vt/discovery/healthcheck.go +++ b/go/vt/discovery/healthcheck.go @@ -760,6 +760,8 @@ func (hc *HealthCheckImpl) waitForTablets(ctx context.Context, targets []*query. // Unblock after the sleep or when the context has expired. timer := time.NewTimer(waitAvailableTabletInterval) + waitLogPeriod := 5 * time.Second + waitLogSoFar := 0 * time.Second select { case <-ctx.Done(): timer.Stop() @@ -770,6 +772,17 @@ 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, *target) + } + } + log.Infof("Still waiting for targets %+v", nonNilTargets) + } } } }