Skip to content

Commit

Permalink
storage: remove errant log message
Browse files Browse the repository at this point in the history
There may be nothing to roll back, so don't log unconditionally.

Release note: None
  • Loading branch information
tbg committed Aug 30, 2019
1 parent c78d4db commit fe6452f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/storage/replica_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -975,10 +975,11 @@ func (r *Replica) changeReplicasImpl(
}
// Don't leave a learner replica lying around if we didn't succeed in
// promoting it to a voter.
targets := chgs.Additions()
log.Infof(ctx, "could not promote %v to voter, rolling back: %v", targets, err)
for _, target := range targets {
r.tryRollBackLearnerReplica(ctx, r.Desc(), target, reason, details)
if targets := chgs.Additions(); len(targets) > 0 {
log.Infof(ctx, "could not promote %v to voter, rolling back: %v", targets, err)
for _, target := range targets {
r.tryRollBackLearnerReplica(ctx, r.Desc(), target, reason, details)
}
}
return nil, err
}
Expand Down

0 comments on commit fe6452f

Please sign in to comment.