Skip to content
This repository was archived by the owner on Aug 13, 2019. It is now read-only.

Commit d577ed4

Browse files
author
Krasi Georgiev
committed
rebase master
Signed-off-by: Krasi Georgiev <[email protected]>
1 parent 5b753bb commit d577ed4

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

scan.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,11 @@ func removeCompleteOutsiders(chks []chunks.Meta, mint int64, maxt int64) ([]chun
332332
goodChunks := make([]chunks.Meta, 0, len(chks))
333333
for _, c := range chks {
334334
// min or max chunk time is within the time range. We don't remove partial outsiders.
335-
if intervalOverlap(mint, maxt, c.MinTime, c.MaxTime) {
335+
if c.OverlapsClosedInterval(mint, maxt) {
336336
// Skip if the chunk is overlapping with the previous one.
337337
if len(goodChunks) > 0 {
338338
last := goodChunks[len(goodChunks)-1]
339-
if intervalOverlap(c.MinTime, c.MaxTime, last.MinTime, last.MaxTime) {
339+
if c.OverlapsClosedInterval(last.MinTime, last.MaxTime) {
340340
continue
341341
}
342342
}
@@ -361,7 +361,7 @@ func repairPartialOutsiders(chks []chunks.Meta, mint int64, maxt int64) ([]chunk
361361
MinTime: 0,
362362
Ref: c.Ref,
363363
}
364-
if intervalOverlap(mint, maxt, c.MinTime, c.MaxTime) && (c.MinTime < mint || c.MaxTime > maxt) {
364+
if c.OverlapsClosedInterval(mint, maxt) && (c.MinTime < mint || c.MaxTime > maxt) {
365365
repairedChunk.Ref = c.Ref
366366
app, err := repairedChunk.Chunk.Appender()
367367
if err != nil {
@@ -449,22 +449,20 @@ func indexStats(bdir string) (IndexStats, error) {
449449
stats.ChunksTotal += len(chks)
450450

451451
for i, c := range chks {
452-
var lastChunk chunks.Meta
453452
if i > 0 {
454-
lastChunk = chks[i-1]
453+
// Overlapping chunks.
454+
if c.OverlapsClosedInterval(chks[i-1].MinTime, chks[i-1].MaxTime) {
455+
ooo++
456+
}
455457
}
456458

457-
if !intervalOverlap(block.Meta().MinTime, block.Meta().MaxTime, c.MinTime, c.MaxTime) {
459+
if !c.OverlapsClosedInterval(block.Meta().MinTime, block.Meta().MaxTime) {
458460
stats.ChunksEntireOutsiders++
459461
} else if c.MinTime < block.Meta().MinTime || c.MaxTime > block.Meta().MaxTime {
460462
stats.ChunksPartialOutsiders++
461463

462464
}
463465

464-
// Overlapping chunks.
465-
if intervalOverlap(lastChunk.MinTime, lastChunk.MaxTime, c.MinTime, c.MaxTime) {
466-
ooo++
467-
}
468466
}
469467
if ooo > 0 {
470468
stats.ChunksOverlapingTotal += ooo

0 commit comments

Comments
 (0)