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 1/3] 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) + } } } } From 49ac1adc2672caff86dfb5613c7ecb5aed8f9dc9 Mon Sep 17 00:00:00 2001 From: "Eduardo J. Ortega U." <5791035+ejortegau@users.noreply.github.com> Date: Wed, 27 Nov 2024 11:07:51 +0100 Subject: [PATCH 2/3] Fix 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/go/vt/discovery/healthcheck.go b/go/vt/discovery/healthcheck.go index fcdec0b1af6..f2ecca7ea4c 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 @@ -760,8 +764,6 @@ 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() From ec7eca2088b4c59615c0a63bf2bc75576da8f855 Mon Sep 17 00:00:00 2001 From: "Eduardo J. Ortega U." <5791035+ejortegau@users.noreply.github.com> Date: Wed, 27 Nov 2024 18:42:01 +0100 Subject: [PATCH 3/3] Improve 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go/vt/discovery/healthcheck.go b/go/vt/discovery/healthcheck.go index f2ecca7ea4c..440737bd696 100644 --- a/go/vt/discovery/healthcheck.go +++ b/go/vt/discovery/healthcheck.go @@ -780,7 +780,8 @@ func (hc *HealthCheckImpl) waitForTablets(ctx context.Context, targets []*query. var nonNilTargets = []query.Target{} for _, target := range targets { if target != nil { - nonNilTargets = append(nonNilTargets, *target) + 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)