Skip to content

Commit

Permalink
tabletserver: Fix problem that the wrong type was used in an error st…
Browse files Browse the repository at this point in the history
…ring when printing the current state.

Unified other places where we print or log the state as well.
  • Loading branch information
michael-berlin committed Oct 4, 2016
1 parent b64d412 commit 0993d72
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions go/vt/tabletserver/tabletserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (tsv *TabletServer) GetState() string {
// setState changes the state and logs the event.
// It requires the caller to hold a lock on mu.
func (tsv *TabletServer) setState(state int64) {
log.Infof("TabletServer state: %v -> %v", stateName[tsv.state], stateName[state])
log.Infof("TabletServer state: %s -> %s", stateName[tsv.state], stateName[state])
tsv.state = state
tsv.history.Add(&historyRecord{
Time: time.Now(),
Expand All @@ -265,7 +265,7 @@ func (tsv *TabletServer) InitDBConfig(target querypb.Target, dbconfigs dbconfigs
tsv.mu.Lock()
defer tsv.mu.Unlock()
if tsv.state != StateNotConnected {
return NewTabletError(vtrpcpb.ErrorCode_INTERNAL_ERROR, "InitDBConfig failed, current state: %d", tsv.state)
return NewTabletError(vtrpcpb.ErrorCode_INTERNAL_ERROR, "InitDBConfig failed, current state: %s", stateName[tsv.state])
}
tsv.target = target
tsv.dbconfigs = dbconfigs
Expand Down Expand Up @@ -368,7 +368,7 @@ func (tsv *TabletServer) decideAction(tabletType topodatapb.TabletType, serving
tsv.setState(StateTransitioning)
return actionServeNewType, nil
case StateTransitioning, StateShuttingDown:
return actionNone, NewTabletError(vtrpcpb.ErrorCode_INTERNAL_ERROR, "cannot SetServingType, current state: %s", tsv.state)
return actionNone, NewTabletError(vtrpcpb.ErrorCode_INTERNAL_ERROR, "cannot SetServingType, current state: %s", stateName[tsv.state])
default:
panic("uncreachable")
}
Expand Down

0 comments on commit 0993d72

Please sign in to comment.