Skip to content

Commit

Permalink
add-some-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
shanth96 committed Jul 15, 2024
1 parent 8fb4a7d commit fbcf4ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions go/vt/vttablet/tabletserver/schema/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()

Expand Down
11 changes: 7 additions & 4 deletions go/vt/vttablet/tabletserver/state_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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()
}
Expand Down

0 comments on commit fbcf4ab

Please sign in to comment.