removed redundant buf writer, and checks
This commit is contained in:
parent
61ba81e964
commit
448201243a
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue