diff --git a/raft/tracker/inflights.go b/raft/tracker/inflights.go index 1a056341ab51..242d1cab1cd9 100644 --- a/raft/tracker/inflights.go +++ b/raft/tracker/inflights.go @@ -113,10 +113,6 @@ func (in *Inflights) FreeLE(to uint64) { } } -// FreeFirstOne releases the first inflight. This is a no-op if nothing is -// inflight. -func (in *Inflights) FreeFirstOne() { in.FreeLE(in.buffer[in.start]) } - // Full returns true if no more messages can be sent at the moment. func (in *Inflights) Full() bool { return in.count == in.size diff --git a/raft/tracker/inflights_test.go b/raft/tracker/inflights_test.go index 582a373ba560..0a56ced346e7 100644 --- a/raft/tracker/inflights_test.go +++ b/raft/tracker/inflights_test.go @@ -105,6 +105,20 @@ func TestInflightFreeTo(t *testing.T) { in.Add(uint64(i)) } + in.FreeLE(0) + + wantIn0 := &Inflights{ + start: 1, + count: 9, + size: 10, + // ↓------------------------ + buffer: []uint64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, + } + + if !reflect.DeepEqual(in, wantIn0) { + t.Fatalf("in = %+v, want %+v", in, wantIn0) + } + in.FreeLE(4) wantIn := &Inflights{ @@ -166,24 +180,3 @@ func TestInflightFreeTo(t *testing.T) { t.Fatalf("in = %+v, want %+v", in, wantIn4) } } - -func TestInflightFreeFirstOne(t *testing.T) { - in := NewInflights(10) - for i := 0; i < 10; i++ { - in.Add(uint64(i)) - } - - in.FreeFirstOne() - - wantIn := &Inflights{ - start: 1, - count: 9, - size: 10, - // ↓------------------------ - buffer: []uint64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, - } - - if !reflect.DeepEqual(in, wantIn) { - t.Fatalf("in = %+v, want %+v", in, wantIn) - } -}