From 300d396cbf0d4777b511a1814c174f4d75752075 Mon Sep 17 00:00:00 2001 From: Tiger Date: Tue, 16 Jun 2020 13:55:25 +0530 Subject: [PATCH] minor Signed-off-by: Tiger --- table/table.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/table/table.go b/table/table.go index 1f8ba90a6..e66fa63d0 100644 --- a/table/table.go +++ b/table/table.go @@ -596,11 +596,13 @@ func (t *Table) block(idx int) (*block, error) { // bfCacheKey returns the cache key for bloom filter. func (t *Table) bfCacheKey() []byte { y.AssertTrue(t.id < math.MaxUint32) - buf := make([]byte, 4) - binary.BigEndian.PutUint32(buf, uint32(t.id)) - + buf := make([]byte, 6) // Without the "bf" prefix, we will have conflict with the blockCacheKey. - return append([]byte("bf"), buf...) + buf[0] = 'b' + buf[1] = 'f' + + binary.BigEndian.PutUint32(buf[2:], uint32(t.id)) + return buf } func (t *Table) blockCacheKey(idx int) []byte { @@ -620,6 +622,7 @@ func (t *Table) blockOffsetsCacheKey() []byte { buf := make([]byte, 6) buf[0] = 'b' buf[1] = 'o' + binary.BigEndian.PutUint32(buf[2:], uint32(t.id)) return buf }