tsdb.BeyondTimeRetention: Fix comment and test at retention duration
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
parent
d0ecf9b8fc
commit
9c7a734063
|
@ -1608,7 +1608,7 @@ func BeyondTimeRetention(db *DB, blocks []*Block) (deletable map[ulid.ULID]struc
|
|||
|
||||
deletable = make(map[ulid.ULID]struct{})
|
||||
for i, block := range blocks {
|
||||
// The difference between the first block and this block is larger than
|
||||
// The difference between the first block and this block is greater than or equal to
|
||||
// the retention period so any blocks after that are added as deletable.
|
||||
if i > 0 && blocks[0].Meta().MaxTime-block.Meta().MaxTime >= db.opts.RetentionDuration {
|
||||
for _, b := range blocks[i:] {
|
||||
|
|
|
@ -689,10 +689,10 @@ func TestDB_BeyondTimeRetention(t *testing.T) {
|
|||
require.NoError(t, db.Close())
|
||||
}()
|
||||
|
||||
// We have 4 blocks, 3 of which are beyond the retention duration.
|
||||
// We have 4 blocks, 3 of which are beyond or at the retention duration.
|
||||
metas := []BlockMeta{
|
||||
{MinTime: 300, MaxTime: 500},
|
||||
{MinTime: 200, MaxTime: 300},
|
||||
{MinTime: 200, MaxTime: 400},
|
||||
{MinTime: 100, MaxTime: 200},
|
||||
{MinTime: 0, MaxTime: 100},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue