From fe6452f21d5549fe5cfe5ab8a1734c0df200a373 Mon Sep 17 00:00:00 2001 From: Tobias Schottdorf Date: Thu, 29 Aug 2019 15:38:28 +0200 Subject: [PATCH] storage: remove errant log message There may be nothing to roll back, so don't log unconditionally. Release note: None --- pkg/storage/replica_command.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 }