C# Class Lucene.Net.Util.FieldCacheSanityChecker

Provides methods for sanity checking that entries in the FieldCache are not wasteful or inconsistent.

Lucene 2.9 Introduced numerous enhancements into how the FieldCache is used by the low levels of Lucene searching (for Sorting and ValueSourceQueries) to improve both the speed for Sorting, as well as reopening of IndexReaders. But these changes have shifted the usage of FieldCache from "top level" IndexReaders (frequently a MultiReader or DirectoryReader) down to the leaf level SegmentReaders. As a result, existing applications that directly access the FieldCache may find RAM usage increase significantly when upgrading to 2.9 or Later. this class provides an API for these applications (or their Unit tests) to check at run time if the FieldCache contains "insane" usages of the FieldCache.

@lucene.experimental
显示文件 Open project: apache/lucenenet Class Usage Examples

Public Methods

Method Description
Check ( ) : Insanity[]

Tests a CacheEntry[] for indication of "insane" cache usage.

NOTE:FieldCache CreationPlaceholder objects are ignored. (:TODO: is this a bad idea? are we masking a real problem?)

CheckSanity ( ) : Insanity[]

Quick and dirty convenience method that instantiates an instance with "good defaults" and uses it to test the CacheEntrys

CheckSanity ( IFieldCache cache ) : Insanity[]

Quick and dirty convenience method

FieldCacheSanityChecker ( ) : System.Collections.Generic

Private Methods

Method Description
CheckSubreaders ( FieldCache.CacheEntry>.MapOfSets valIdToItems, int>.MapOfSets readerFieldToValIds ) : ICollection

Internal helper method used by check that iterates over the keys of readerFieldToValIds and generates a Collection of Insanity instances whenever two (or more) ReaderField instances are found that have an ancestry relationships.

CheckValueMismatch ( FieldCache.CacheEntry>.MapOfSets valIdToItems, int>.MapOfSets readerFieldToValIds, ISet valMismatchKeys ) : ICollection

Internal helper method used by check that iterates over valMismatchKeys and generates a Collection of Insanity instances accordingly. The MapOfSets are used to populate the Insanity objects.

GetAllDescendantReaderKeys ( object seed ) : IList

Checks if the seed is an IndexReader, and if so will walk the hierarchy of subReaders building up a list of the objects returned by {@code seed.getCoreCacheKey()}

Method Details

Check() public method

Tests a CacheEntry[] for indication of "insane" cache usage.

NOTE:FieldCache CreationPlaceholder objects are ignored. (:TODO: is this a bad idea? are we masking a real problem?)

public Check ( ) : Insanity[]
return Insanity[]

CheckSanity() public static method

Quick and dirty convenience method that instantiates an instance with "good defaults" and uses it to test the CacheEntrys
public static CheckSanity ( ) : Insanity[]
return Insanity[]

CheckSanity() public static method

Quick and dirty convenience method
public static CheckSanity ( IFieldCache cache ) : Insanity[]
cache IFieldCache
return Insanity[]

FieldCacheSanityChecker() public method

public FieldCacheSanityChecker ( ) : System.Collections.Generic
return System.Collections.Generic