From 57def668ac557c193578105340c8990bf634aef0 Mon Sep 17 00:00:00 2001 From: Tobias Schottdorf Date: Wed, 19 Jun 2019 13:04:31 +0200 Subject: [PATCH] fixup! don't zero the zeroes --- raft/quorum/majority.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/raft/quorum/majority.go b/raft/quorum/majority.go index 3f964fc2b937..3d7bf82335ab 100644 --- a/raft/quorum/majority.go +++ b/raft/quorum/majority.go @@ -122,9 +122,9 @@ func (c MajorityConfig) CommittedIndex(l AckedIndexer) Index { { // Fill the slice with the indexes observed. Any unused slots will be - // zeroed; these correspond to voters that may report in, but haven't - // yet. We fill from the right (since the zeroes will end up on the left - // after sorting below anyway). + // left as zero; these correspond to voters that may report in, but + // haven't yet. We fill from the right (since the zeroes will end up on + // the left after sorting below anyway). i := n - 1 for id := range c { if idx, ok := l.AckedIndex(id); ok { @@ -132,9 +132,6 @@ func (c MajorityConfig) CommittedIndex(l AckedIndexer) Index { i-- } } - for j := 0; j <= i; j++ { - srt[j] = 0 - } } // Sort by index. Use a bespoke algorithm (copied from the stdlib's sort