snapshot: Remove truncation check to restore func.

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
This commit is contained in:
Goutham Veeramachaneni 2017-10-04 16:58:07 +05:30
parent c9fc2af6c0
commit 203012169a
No known key found for this signature in database
GPG Key ID: F1C217E8E9023CAD
2 changed files with 2 additions and 5 deletions

View File

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

View File

@ -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)