Skip to content

Commit

Permalink
Add logging to the healthcheck's waiting for targets
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo J. Ortega U. <5791035+ejortegau@users.noreply.github.com>
  • Loading branch information
ejortegau committed Nov 27, 2024
1 parent f75d407 commit a82a8d1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions go/vt/discovery/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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

Check failure on line 777 in go/vt/discovery/healthcheck.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

ineffectual assignment to waitLogSoFar (ineffassign)
var nonNilTargets = []query.Target{}
for _, target := range targets {
if target != nil {
nonNilTargets = append(nonNilTargets, *target)

Check failure on line 781 in go/vt/discovery/healthcheck.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

copylocks: call of append copies lock value: vitess.io/vitess/go/vt/proto/query.Target contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex (govet)
}
}
log.Infof("Still waiting for targets %+v", nonNilTargets)
}
}
}
}
Expand Down

0 comments on commit a82a8d1

Please sign in to comment.