Add NumTombstones to BlockMeta.

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
This commit is contained in:
Goutham Veeramachaneni 2017-05-23 17:37:04 +05:30
parent 9d388941ef
commit 31cf939448
No known key found for this signature in database
GPG Key ID: F1C217E8E9023CAD
2 changed files with 11 additions and 1 deletions

View File

@ -95,6 +95,9 @@ type BlockMeta struct {
Compaction struct {
Generation int `json:"generation"`
} `json:"compaction"`
// The number of tombstones.
NumTombstones int64 `json:"numTombstones"`
}
const (
@ -278,7 +281,13 @@ Outer:
str := newMapTombstoneReader(delStones)
tombreader := newMergedTombstoneReader(tr, str)
return writeTombstoneFile(pb.dir, tombreader)
if err := writeTombstoneFile(pb.dir, tombreader); err != nil {
return err
}
// TODO(gouthamve): This counts any common tombstones too. But gives the same heuristic.
pb.meta.NumTombstones += int64(len(delStones))
return writeMetaFile(pb.dir, &pb.meta)
}
func chunkDir(dir string) string { return filepath.Join(dir, "chunks") }

View File

@ -267,6 +267,7 @@ Outer:
}
h.tombstones = newMapTombstoneReader(h.tombstones.stones)
h.meta.NumTombstones = int64(len(h.tombstones.stones))
return nil
}