diff --git a/pkg/storage/replica_command.go b/pkg/storage/replica_command.go index 49a0bb1e0862..5f62addd73aa 100644 --- a/pkg/storage/replica_command.go +++ b/pkg/storage/replica_command.go @@ -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 }