tsdb.BeyondTimeRetention: Fix comment and test at retention duration

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen 2024-03-19 09:10:21 +01:00
parent d0ecf9b8fc
commit 9c7a734063
2 changed files with 3 additions and 3 deletions

View File

@ -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:] {

View File

@ -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},
}