Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
Signed-off-by: Tiger <rbalajis25@gmail.com>
  • Loading branch information
poonai committed Jun 16, 2020
1 parent 814631c commit 300d396
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions table/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down

0 comments on commit 300d396

Please sign in to comment.