diff --git a/memstore.go b/memstore.go index 778b3c4..b708747 100644 --- a/memstore.go +++ b/memstore.go @@ -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) } diff --git a/memstore_test.go b/memstore_test.go index 8967103..8809399 100644 --- a/memstore_test.go +++ b/memstore_test.go @@ -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 {