From dbb8f5861da48ada9b1a81da15330251aab05be8 Mon Sep 17 00:00:00 2001 From: zhulongcheng Date: Sun, 22 Mar 2020 15:29:35 +0800 Subject: [PATCH] tsdb: add tombstonesHeaderSize constant (#7028) Signed-off-by: zhulongcheng --- tsdb/tombstones/tombstones.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tsdb/tombstones/tombstones.go b/tsdb/tombstones/tombstones.go index 20a1007c7..615c6d743 100644 --- a/tsdb/tombstones/tombstones.go +++ b/tsdb/tombstones/tombstones.go @@ -38,7 +38,8 @@ const ( // MagicTombstone is 4 bytes at the head of a tombstone file. MagicTombstone = 0x0130BA30 - tombstoneFormatV1 = 1 + tombstoneFormatV1 = 1 + tombstonesHeaderSize = 5 ) // The table gets initialized with sync.Once but may still cause a race @@ -158,7 +159,7 @@ func ReadTombstones(dir string) (Reader, int64, error) { return nil, 0, err } - if len(b) < 5 { + if len(b) < tombstonesHeaderSize { return nil, 0, errors.Wrap(encoding.ErrInvalidSize, "tombstones header") }