Fix bug in calculation of what is archived

This commit is contained in:
Lou Knauer 2021-11-22 17:50:15 +01:00
parent 458383d152
commit 579a05e4df
2 changed files with 4 additions and 1 deletions

View File

@ -45,6 +45,7 @@ func newBuffer(ts, freq int64) *buffer {
b.start = ts
b.prev = nil
b.next = nil
b.archived = false
return b
}
@ -167,7 +168,7 @@ func (b *buffer) iterFromTo(from, to int64, callback func(b *buffer) error) erro
}
end := b.start + int64(len(b.data))*b.frequency
if from <= b.start && end <= to {
if from <= end && b.start <= to {
return callback(b)
}

View File

@ -295,6 +295,8 @@ func TestMemoryStoreArchive(t *testing.T) {
}
}
// store1.DebugDump(bufio.NewWriter(os.Stdout))
archiveRoot := t.TempDir()
_, err := store1.ToCheckpoint(archiveRoot, 100, 100+int64(count/2))
if err != nil {