From 1775602958abb6358f2f490d9914865280d026fa Mon Sep 17 00:00:00 2001 From: Sreekanth Sivasankaran Date: Thu, 15 Mar 2018 14:40:00 +0530 Subject: [PATCH] posting iterator array positions clean up, max segment size limit adjustment for hit-1 optimisation --- index/scorch/mergeplan/merge_plan.go | 6 +++--- index/scorch/segment/zap/posting.go | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/index/scorch/mergeplan/merge_plan.go b/index/scorch/mergeplan/merge_plan.go index f0d6f162..b09e5381 100644 --- a/index/scorch/mergeplan/merge_plan.go +++ b/index/scorch/mergeplan/merge_plan.go @@ -117,14 +117,14 @@ func (o *MergePlanOptions) RaiseToFloorSegmentSize(s int64) int64 { } // MaxSegmentSizeLimit represents the maximum size of a segment, -// this limit comes as the roaring lib supports uint32. -const MaxSegmentSizeLimit = 1<<32 - 1 +// this limit comes with hit-1 optimisation/max encoding limit uint31. +const MaxSegmentSizeLimit = 1<<31 - 1 // ErrMaxSegmentSizeTooLarge is returned when the size of the segment // exceeds the MaxSegmentSizeLimit var ErrMaxSegmentSizeTooLarge = errors.New("MaxSegmentSize exceeds the size limit") -// Suggested default options. +// DefaultMergePlanOptions suggests the default options. var DefaultMergePlanOptions = MergePlanOptions{ MaxSegmentsPerTier: 10, MaxSegmentSize: 5000000, diff --git a/index/scorch/segment/zap/posting.go b/index/scorch/segment/zap/posting.go index bc533ad1..fbe703c1 100644 --- a/index/scorch/segment/zap/posting.go +++ b/index/scorch/segment/zap/posting.go @@ -444,6 +444,8 @@ func (i *PostingsIterator) readLocation(l *Location) error { l.end = end if numArrayPos > 0 { l.ap = make([]uint64, int(numArrayPos)) + } else { + l.ap = l.ap[:0] } }