tsdb: add tombstonesHeaderSize constant (#7028)

Signed-off-by: zhulongcheng <zhulongcheng.dev@gmail.com>
This commit is contained in:
zhulongcheng 2020-03-22 15:29:35 +08:00 committed by GitHub
parent f1984bb007
commit dbb8f5861d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

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