mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Fix incorrect estimated chunks for NewCompactingChunkSeriesMerger
if series are not already sorted.
This commit is contained in:
parent
8b84856ba5
commit
1299d98c46
|
@ -693,7 +693,7 @@ func estimateCompactedChunkCount(series []ChunkSeries) int {
|
|||
for _, s := range series {
|
||||
iter := s.Iterator(nil)
|
||||
if iter.Next() {
|
||||
h.Push(iter)
|
||||
heap.Push(&h, iter)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -429,6 +429,14 @@ func TestCompactingChunkSeriesMerger(t *testing.T) {
|
|||
},
|
||||
expected: NewListChunkSeriesFromSamples(labels.FromStrings("bar", "baz"), []tsdbutil.Sample{fSample{1, 1}, fSample{2, 2}}, []tsdbutil.Sample{fSample{3, 3}, fSample{5, 5}}, []tsdbutil.Sample{fSample{7, 7}, fSample{9, 9}}, []tsdbutil.Sample{fSample{10, 10}}),
|
||||
},
|
||||
{
|
||||
name: "two non overlapping in reverse order",
|
||||
input: []ChunkSeries{
|
||||
NewListChunkSeriesFromSamples(labels.FromStrings("bar", "baz"), []tsdbutil.Sample{fSample{7, 7}, fSample{9, 9}}, []tsdbutil.Sample{fSample{10, 10}}),
|
||||
NewListChunkSeriesFromSamples(labels.FromStrings("bar", "baz"), []tsdbutil.Sample{fSample{1, 1}, fSample{2, 2}}, []tsdbutil.Sample{fSample{3, 3}, fSample{5, 5}}),
|
||||
},
|
||||
expected: NewListChunkSeriesFromSamples(labels.FromStrings("bar", "baz"), []tsdbutil.Sample{fSample{1, 1}, fSample{2, 2}}, []tsdbutil.Sample{fSample{3, 3}, fSample{5, 5}}, []tsdbutil.Sample{fSample{7, 7}, fSample{9, 9}}, []tsdbutil.Sample{fSample{10, 10}}),
|
||||
},
|
||||
{
|
||||
name: "two overlapping",
|
||||
input: []ChunkSeries{
|
||||
|
|
Loading…
Reference in a new issue