0
0
Fork 0

removed redundant buf writer, and checks

This commit is contained in:
Sreekanth Sivasankaran 2017-12-30 16:54:06 +05:30
parent 61ba81e964
commit 448201243a
5 changed files with 6 additions and 11 deletions

View File

@ -51,7 +51,7 @@ func PersistSegment(memSegment *mem.Segment, path string, chunkFactor uint32) (e
var storedIndexOffset uint64
var dictLocs []uint64
var docValueOffset uint64
docValueOffset := uint64(fieldNotUninverted)
if len(memSegment.Stored) > 0 {
storedIndexOffset, err = persistStored(memSegment, cr)

View File

@ -15,7 +15,6 @@
package zap
import (
"bufio"
"bytes"
"encoding/binary"
"io"
@ -87,18 +86,13 @@ func (c *chunkedContentCoder) flushContents() error {
return err
}
w := bufio.NewWriter(&c.chunkMetaBuf)
// write out the metaData slice
for _, meta := range c.chunkMeta {
_, err := writeUvarints(w, meta.DocID, meta.DocDvLoc, meta.DocDvLen)
_, err := writeUvarints(&c.chunkMetaBuf, meta.DocID, meta.DocDvLoc, meta.DocDvLen)
if err != nil {
return err
}
}
err = w.Flush()
if err != nil {
return err
}
// write the metadata to final data
metaData := c.chunkMetaBuf.Bytes()

View File

@ -46,7 +46,7 @@ func (di *docValueIterator) curChunkNumber() uint64 {
func (s *Segment) loadFieldDocValueIterator(field string,
fieldDvLoc uint64) (*docValueIterator, error) {
// get the docValue offset for the given fields
if fieldDvLoc == math.MaxUint64 {
if fieldDvLoc == fieldNotUninverted {
return nil, fmt.Errorf("loadFieldDocValueConfigs: "+
"no docValues found for field: %s", field)
}

View File

@ -53,7 +53,8 @@ func Merge(segments []*Segment, drops []*roaring.Bitmap, path string,
newSegDocCount := computeNewDocCount(segments, drops)
var newDocNums [][]uint64
var storedIndexOffset, fieldDvLocsOffset uint64
var storedIndexOffset uint64
fieldDvLocsOffset := uint64(fieldNotUninverted)
var dictLocs []uint64
if newSegDocCount > 0 {
storedIndexOffset, newDocNums, err = mergeStoredAndRemap(segments, drops,

View File

@ -401,7 +401,7 @@ func (s *Segment) DictAddr(field string) (uint64, error) {
}
func (s *Segment) loadDvIterators() error {
if s.docValueOffset == fieldNotUninverted || s.docValueOffset == 0 {
if s.docValueOffset == fieldNotUninverted {
return nil
}