Do not account IndexReader's size in the query RAM estimate
Since its just the pointer size of the IndexReader that is being accounted for while estimating the RAM needed to execute a search query, get rid of the Size() API in the IndexReader interface.
This commit is contained in:
parent
d1b84d4578
commit
65fed52d0b
|
@ -94,8 +94,6 @@ type IndexReader interface {
|
||||||
DumpFields() chan interface{}
|
DumpFields() chan interface{}
|
||||||
|
|
||||||
Close() error
|
Close() error
|
||||||
|
|
||||||
Size() int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FieldTerms contains the terms used by a document, keyed by field
|
// FieldTerms contains the terms used by a document, keyed by field
|
||||||
|
|
|
@ -27,7 +27,6 @@ import (
|
||||||
"github.com/blevesearch/bleve/document"
|
"github.com/blevesearch/bleve/document"
|
||||||
"github.com/blevesearch/bleve/index"
|
"github.com/blevesearch/bleve/index"
|
||||||
"github.com/blevesearch/bleve/index/scorch/segment"
|
"github.com/blevesearch/bleve/index/scorch/segment"
|
||||||
"github.com/blevesearch/bleve/size"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type asynchSegmentResult struct {
|
type asynchSegmentResult struct {
|
||||||
|
@ -90,12 +89,6 @@ func (i *IndexSnapshot) Close() error {
|
||||||
return i.DecRef()
|
return i.DecRef()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *IndexSnapshot) Size() int {
|
|
||||||
// Just return the size of the pointer for estimating the overhead
|
|
||||||
// during Search, a reference of the IndexSnapshot serves as the reader.
|
|
||||||
return size.SizeOfPtr
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *IndexSnapshot) newIndexSnapshotFieldDict(field string, makeItr func(i segment.TermDictionary) segment.DictionaryIterator) (*IndexSnapshotFieldDict, error) {
|
func (i *IndexSnapshot) newIndexSnapshotFieldDict(field string, makeItr func(i segment.TermDictionary) segment.DictionaryIterator) (*IndexSnapshotFieldDict, error) {
|
||||||
|
|
||||||
results := make(chan *asynchSegmentResult)
|
results := make(chan *asynchSegmentResult)
|
||||||
|
|
|
@ -20,7 +20,6 @@ import (
|
||||||
"github.com/blevesearch/bleve/document"
|
"github.com/blevesearch/bleve/document"
|
||||||
"github.com/blevesearch/bleve/index"
|
"github.com/blevesearch/bleve/index"
|
||||||
"github.com/blevesearch/bleve/index/store"
|
"github.com/blevesearch/bleve/index/store"
|
||||||
"github.com/blevesearch/bleve/size"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var reflectStaticSizeIndexReader int
|
var reflectStaticSizeIndexReader int
|
||||||
|
@ -36,10 +35,6 @@ type IndexReader struct {
|
||||||
docCount uint64
|
docCount uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *IndexReader) Size() int {
|
|
||||||
return reflectStaticSizeIndexReader + size.SizeOfPtr
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *IndexReader) TermFieldReader(term []byte, fieldName string, includeFreq, includeNorm, includeTermVectors bool) (index.TermFieldReader, error) {
|
func (i *IndexReader) TermFieldReader(term []byte, fieldName string, includeFreq, includeNorm, includeTermVectors bool) (index.TermFieldReader, error) {
|
||||||
fieldIndex, fieldExists := i.index.fieldCache.FieldNamed(fieldName, false)
|
fieldIndex, fieldExists := i.index.fieldCache.FieldNamed(fieldName, false)
|
||||||
if fieldExists {
|
if fieldExists {
|
||||||
|
|
|
@ -203,7 +203,7 @@ type UpsideDownCouchDocIDReader struct {
|
||||||
|
|
||||||
func (r *UpsideDownCouchDocIDReader) Size() int {
|
func (r *UpsideDownCouchDocIDReader) Size() int {
|
||||||
sizeInBytes := reflectStaticSizeUpsideDownCouchDocIDReader +
|
sizeInBytes := reflectStaticSizeUpsideDownCouchDocIDReader +
|
||||||
r.indexReader.Size()
|
reflectStaticSizeIndexReader + size.SizeOfPtr
|
||||||
|
|
||||||
for _, entry := range r.only {
|
for _, entry := range r.only {
|
||||||
sizeInBytes += size.SizeOfString + len(entry)
|
sizeInBytes += size.SizeOfString + len(entry)
|
||||||
|
|
|
@ -66,8 +66,7 @@ func NewFacetsBuilder(indexReader index.IndexReader) *FacetsBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fb *FacetsBuilder) Size() int {
|
func (fb *FacetsBuilder) Size() int {
|
||||||
sizeInBytes := reflectStaticSizeFacetsBuilder + size.SizeOfPtr +
|
sizeInBytes := reflectStaticSizeFacetsBuilder + size.SizeOfPtr
|
||||||
fb.indexReader.Size()
|
|
||||||
|
|
||||||
for k, v := range fb.facets {
|
for k, v := range fb.facets {
|
||||||
sizeInBytes += size.SizeOfString + len(k) +
|
sizeInBytes += size.SizeOfString + len(k) +
|
||||||
|
|
|
@ -62,8 +62,7 @@ func NewBooleanSearcher(indexReader index.IndexReader, mustSearcher search.Searc
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *BooleanSearcher) Size() int {
|
func (s *BooleanSearcher) Size() int {
|
||||||
sizeInBytes := reflectStaticSizeBooleanSearcher + size.SizeOfPtr +
|
sizeInBytes := reflectStaticSizeBooleanSearcher + size.SizeOfPtr
|
||||||
s.indexReader.Size()
|
|
||||||
|
|
||||||
if s.mustSearcher != nil {
|
if s.mustSearcher != nil {
|
||||||
sizeInBytes += s.mustSearcher.Size()
|
sizeInBytes += s.mustSearcher.Size()
|
||||||
|
|
|
@ -101,7 +101,6 @@ func newDisjunctionSearcher(indexReader index.IndexReader,
|
||||||
|
|
||||||
func (s *DisjunctionSearcher) Size() int {
|
func (s *DisjunctionSearcher) Size() int {
|
||||||
sizeInBytes := reflectStaticSizeDisjunctionSearcher + size.SizeOfPtr +
|
sizeInBytes := reflectStaticSizeDisjunctionSearcher + size.SizeOfPtr +
|
||||||
s.indexReader.Size() +
|
|
||||||
s.scorer.Size()
|
s.scorer.Size()
|
||||||
|
|
||||||
for _, entry := range s.searchers {
|
for _, entry := range s.searchers {
|
||||||
|
|
|
@ -58,7 +58,6 @@ func NewMatchAllSearcher(indexReader index.IndexReader, boost float64, options s
|
||||||
|
|
||||||
func (s *MatchAllSearcher) Size() int {
|
func (s *MatchAllSearcher) Size() int {
|
||||||
return reflectStaticSizeMatchAllSearcher + size.SizeOfPtr +
|
return reflectStaticSizeMatchAllSearcher + size.SizeOfPtr +
|
||||||
s.indexReader.Size() +
|
|
||||||
s.reader.Size() +
|
s.reader.Size() +
|
||||||
s.scorer.Size()
|
s.scorer.Size()
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,7 @@ func NewMatchNoneSearcher(indexReader index.IndexReader) (*MatchNoneSearcher, er
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MatchNoneSearcher) Size() int {
|
func (s *MatchNoneSearcher) Size() int {
|
||||||
return reflectStaticSizeMatchNoneSearcher + size.SizeOfPtr +
|
return reflectStaticSizeMatchNoneSearcher + size.SizeOfPtr
|
||||||
s.indexReader.Size()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *MatchNoneSearcher) Count() uint64 {
|
func (s *MatchNoneSearcher) Count() uint64 {
|
||||||
|
|
|
@ -42,8 +42,7 @@ type PhraseSearcher struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *PhraseSearcher) Size() int {
|
func (s *PhraseSearcher) Size() int {
|
||||||
sizeInBytes := reflectStaticSizePhraseSearcher + size.SizeOfPtr +
|
sizeInBytes := reflectStaticSizePhraseSearcher + size.SizeOfPtr
|
||||||
s.indexReader.Size()
|
|
||||||
|
|
||||||
if s.mustSearcher != nil {
|
if s.mustSearcher != nil {
|
||||||
sizeInBytes += s.mustSearcher.Size()
|
sizeInBytes += s.mustSearcher.Size()
|
||||||
|
|
|
@ -75,7 +75,6 @@ func NewTermSearcherBytes(indexReader index.IndexReader, term []byte, field stri
|
||||||
|
|
||||||
func (s *TermSearcher) Size() int {
|
func (s *TermSearcher) Size() int {
|
||||||
return reflectStaticSizeTermSearcher + size.SizeOfPtr +
|
return reflectStaticSizeTermSearcher + size.SizeOfPtr +
|
||||||
s.indexReader.Size() +
|
|
||||||
s.reader.Size() +
|
s.reader.Size() +
|
||||||
s.tfd.Size() +
|
s.tfd.Size() +
|
||||||
s.scorer.Size()
|
s.scorer.Size()
|
||||||
|
|
Loading…
Reference in New Issue