From fbcf4ab3dc6d29229c7bccdce17dc18d770ff00d Mon Sep 17 00:00:00 2001 From: shanth96 Date: Mon, 15 Jul 2024 09:56:05 -0400 Subject: [PATCH] add-some-logs --- go/vt/vttablet/tabletserver/schema/engine.go | 5 +++-- go/vt/vttablet/tabletserver/state_manager.go | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/go/vt/vttablet/tabletserver/schema/engine.go b/go/vt/vttablet/tabletserver/schema/engine.go index 1995bd5472d..06765e85df3 100644 --- a/go/vt/vttablet/tabletserver/schema/engine.go +++ b/go/vt/vttablet/tabletserver/schema/engine.go @@ -258,7 +258,7 @@ func (se *Engine) Open() error { se.notifiers = make(map[string]notifier) if err := se.reload(ctx, true); err != nil { - return err + return fmt.Errorf("schema reload failed: %v", err) } if !se.SkipMetaCheck { if err := se.historian.Open(); err != nil { @@ -406,12 +406,13 @@ func (se *Engine) reload(ctx context.Context, includeStats bool) error { } // add a timeout to prevent unbounded waits + log.Info("Reloading timeout: %v", se.reloadTimeout) ctx, cancel := context.WithTimeout(ctx, se.reloadTimeout) defer cancel() conn, err := se.conns.Get(ctx, nil) if err != nil { - return err + return fmt.Errorf("failed to get connection to reload: %v", err) } defer conn.Recycle() diff --git a/go/vt/vttablet/tabletserver/state_manager.go b/go/vt/vttablet/tabletserver/state_manager.go index 9c01610f770..b9d55533406 100644 --- a/go/vt/vttablet/tabletserver/state_manager.go +++ b/go/vt/vttablet/tabletserver/state_manager.go @@ -286,12 +286,14 @@ func (sm *stateManager) execTransition(tabletType topodatapb.TabletType, state s func (sm *stateManager) retryTransition(message string) { sm.mu.Lock() defer sm.mu.Unlock() + log.Error(message) + if sm.retrying { return } sm.retrying = true - log.Error(message) + go func() { for { time.Sleep(transitionRetryInterval) @@ -306,6 +308,7 @@ func (sm *stateManager) recheckState() bool { sm.mu.Lock() defer sm.mu.Unlock() + log.Info("Want: %v, %v, Have: %v, %v", sm.wantTabletType, sm.wantState, sm.target.TabletType, sm.state) if sm.wantState == sm.state && sm.wantTabletType == sm.target.TabletType { sm.retrying = false return true @@ -547,14 +550,14 @@ func (sm *stateManager) unserveNonPrimary(wantTabletType topodatapb.TabletType) func (sm *stateManager) connect(tabletType topodatapb.TabletType) error { if err := sm.se.EnsureConnectionAndDB(tabletType); err != nil { - return err + return fmt.Errorf("ensure connection and db failed: %v", err) } if err := sm.se.Open(); err != nil { - return err + return fmt.Errorf("schema engine open failed: %v", err) } sm.vstreamer.Open() if err := sm.qe.Open(); err != nil { - return err + return fmt.Errorf("query engine open failed: %v", err) } return sm.txThrottler.Open() }