Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ibrahim Jarif committed Dec 10, 2019
1 parent ad6e521 commit 4130bba
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion db.go
Original file line number Diff line number Diff line change
Expand Up @@ -899,12 +899,12 @@ func buildL0Table(ft flushTask, bopts table.Options) []byte {
defer iter.Close()
b := table.NewTableBuilder(bopts)
defer b.Close()
var vp valuePointer
for iter.SeekToFirst(); iter.Valid(); iter.Next() {
if len(ft.dropPrefix) > 0 && bytes.HasPrefix(iter.Key(), ft.dropPrefix) {
continue
}
vs := iter.Value()
var vp valuePointer
if vs.Meta&bitValuePointer > 0 {
vp.Decode(vs.Value)
}
Expand Down
2 changes: 1 addition & 1 deletion levels.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ func (s *levelsController) compactBuildTables(
resultCh := make(chan newTableResult)
var numBuilds, numVersions int
var lastKey, skipKey []byte
var vp valuePointer
for it.Valid() {
timeStart := time.Now()
dk, err := s.kv.registry.latestDataKey()
Expand Down Expand Up @@ -584,7 +585,6 @@ func (s *levelsController) compactBuildTables(
}
}
numKeys++
var vp valuePointer
if vs.Meta&bitValuePointer > 0 {
vp.Decode(vs.Value)
}
Expand Down
2 changes: 1 addition & 1 deletion table/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type Builder struct {
baseOffset uint32 // Offset for the current block.
entryOffsets []uint32 // Offsets of entries present in current block.
tableIndex *pb.TableIndex
keyHashes []uint64 // Used for building bloomfilter.
keyHashes []uint64 // Used for building the bloomfilter.
opt *Options
}

Expand Down
10 changes: 6 additions & 4 deletions table/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ type Table struct {
smallest, biggest []byte // Smallest and largest keys (with timestamps).
id uint64 // file id, part of filename

bf *z.Bloom
Checksum []byte
estimatedSize uint64 // Stores the total size of key-values stored in this table.
bf *z.Bloom
Checksum []byte
// Stores the total size of key-values stored in this table (including the size on vlog).
estimatedSize uint64

IsInmemory bool // Set to true if the table is on level 0 and opened in memory.
opt *Options
Expand Down Expand Up @@ -441,7 +442,8 @@ func (t *Table) blockCacheKey(idx int) uint64 {
return (t.ID() << 32) | uint64(idx)
}

// EstimatedSize returns the total size of key-values stored in this table.
// EstimatedSize returns the total size of key-values stored in this table (including the
// disk space occupied on the value log).
func (t *Table) EstimatedSize() uint64 { return t.estimatedSize }

// Size is its file size in bytes
Expand Down

0 comments on commit 4130bba

Please sign in to comment.