0
0
Fork 0

scorch zap merge computeNewDocCount() optimize 1 variable

This commit is contained in:
Steve Yen 2018-01-27 10:45:23 -08:00
parent 6985db13a0
commit 0041664bc4
1 changed files with 4 additions and 5 deletions

View File

@ -126,15 +126,14 @@ func mapFields(fields []string) map[string]uint16 {
// computeNewDocCount determines how many documents will be in the newly
// merged segment when obsoleted docs are dropped
func computeNewDocCount(segments []*Segment, drops []*roaring.Bitmap) uint64 {
var newSegDocCount uint64
var newDocCount uint64
for segI, segment := range segments {
segIAfterDrop := segment.NumDocs()
newDocCount += segment.NumDocs()
if drops[segI] != nil {
segIAfterDrop -= drops[segI].GetCardinality()
newDocCount -= drops[segI].GetCardinality()
}
newSegDocCount += segIAfterDrop
}
return newSegDocCount
return newDocCount
}
func persistMergedRest(segments []*Segment, drops []*roaring.Bitmap,