From 203012169adc56dd43986f74d1979f45f9bffbcd Mon Sep 17 00:00:00 2001 From: Goutham Veeramachaneni Date: Wed, 4 Oct 2017 16:58:07 +0530 Subject: [PATCH] snapshot: Remove truncation check to restore func. Signed-off-by: Goutham Veeramachaneni --- head.go | 3 --- head_test.go | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/head.go b/head.go index 00f51e007..82a3459bd 100644 --- a/head.go +++ b/head.go @@ -249,9 +249,6 @@ func (h *Head) ReadWAL() error { func (h *Head) Truncate(mint int64) error { initialize := h.MinTime() == math.MinInt64 - if mint%h.chunkRange != 0 { - return errors.Errorf("truncating at %d not aligned", mint) - } if h.MinTime() >= mint { return nil } diff --git a/head_test.go b/head_test.go index b7603e78e..31713b9c1 100644 --- a/head_test.go +++ b/head_test.go @@ -187,8 +187,8 @@ func TestHead_Truncate(t *testing.T) { } s4.chunks = []*memChunk{} - // Truncation must be aligned. - require.Error(t, h.Truncate(1)) + // Truncation need not be aligned. + require.NoError(t, h.Truncate(1)) h.Truncate(2000)