@@ -3324,7 +3324,7 @@ func (n *raft) runAsCandidate() {
33243324n .RLock ()
33253325nterm := n .term
33263326csz := n .csz
3327- repairing ,initializing := n .repairing ,n .initializing
3327+ repairing ,initializing , pindex , group := n .repairing ,n .initializing , n . pindex , n . group
33283328n .RUnlock ()
33293329
33303330if vresp .granted && nterm == vresp .term {
@@ -3346,7 +3346,20 @@ func (n *raft) runAsCandidate() {
33463346// Become LEADER if we've got voted in by ALL servers.
33473347// We couldn't get quorum based on just our normal votes.
33483348// But, we have heard from the full cluster, and some servers came up empty.
3349- // We know for sure we have the most up-to-date log.
3349+ // We know for sure we have the most up-to-date log, but that log could also be empty.
3350+ if group == defaultMetaGroupName || initializing || ! repairing {
3351+ n .warn ("Self got voted leader by all servers, restarting WAL with %d entries" ,pindex )
3352+ }else {
3353+ // If we are here, this means all logs required reparation (so none were complete),
3354+ // and we were the one with the most up-to-date log. We have either lost "all" or "some" data,
3355+ // but instead of halting, we prefer to become available again. All servers will agree on the
3356+ // new state of the log.
3357+ desc := "the log was fully lost"
3358+ if pindex > 0 {
3359+ desc = "the log was partially reset"
3360+ }
3361+ n .warn ("Self got voted leader by all servers, restarting WAL with %d entries, %s" ,pindex ,desc )
3362+ }
33503363n .switchToLeader ()
33513364return
33523365}