Browse Source

Correctly handle pruning wraparound after ring expansion (#3942)

Fixes #3939
pull/3959/head
Brian Brazil 7 years ago
parent
commit
a8e3d0fc4b
  1. 1
      storage/buffer.go
  2. 5
      storage/buffer_test.go

1
storage/buffer.go

@ -178,6 +178,7 @@ func (r *sampleRing) add(t int64, v float64) {
r.buf = buf
r.i = r.f
r.f += l
l = 2 * l
} else {
r.i++
if r.i >= l {

5
storage/buffer_test.go

@ -48,6 +48,11 @@ func TestSampleRing(t *testing.T) {
delta: 7,
size: 1,
},
{
input: []int64{1, 2, 3, 4, 6},
delta: 4,
size: 4,
},
}
for _, c := range cases {
r := newSampleRing(c.delta, c.size)

Loading…
Cancel
Save