Lucene++ - a full-featured, c++ search engine
API Documentation


Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
Lucene::FieldCacheSanityChecker Class Reference

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

#include <FieldCacheSanityChecker.h>

+ Inheritance diagram for Lucene::FieldCacheSanityChecker:

Public Types

enum  InsanityType { SUBREADER , VALUEMISMATCH , EXPECTED }
 An Enumeration of the different types of "insane" behaviour that may be detected in a FieldCache. More...
 
typedef MapOfSets< int32_t, boost::hash< int32_t >, std::equal_to< int32_t >, FieldCacheEntryPtr, luceneHash< FieldCacheEntryPtr >, luceneEquals< FieldCacheEntryPtr > > MapSetIntFieldCacheEntry
 
typedef MapOfSets< ReaderFieldPtr, luceneHash< ReaderFieldPtr >, luceneEquals< ReaderFieldPtr >, int32_t, boost::hash< int32_t >, std::equal_to< int32_t > > MapSetReaderFieldInt
 
typedef MapOfSets< ReaderFieldPtr, luceneHash< ReaderFieldPtr >, luceneEquals< ReaderFieldPtr >, ReaderFieldPtr, luceneHash< ReaderFieldPtr >, luceneEquals< ReaderFieldPtr > > MapSetReaderFieldReaderField
 

Public Member Functions

 FieldCacheSanityChecker ()
 
virtual ~FieldCacheSanityChecker ()
 
virtual String getClassName ()
 
boost::shared_ptr< FieldCacheSanityCheckershared_from_this ()
 
Collection< InsanityPtrcheck (Collection< FieldCacheEntryPtr > cacheEntries)
 Tests a CacheEntry[] for indication of "insane" cache usage. NOTE: FieldCache CreationPlaceholder objects are ignored.
 
- Public Member Functions inherited from Lucene::LuceneObject
virtual ~LuceneObject ()
 
virtual void initialize ()
 Called directly after instantiation to create objects that depend on this object being fully constructed.
 
virtual LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Return clone of this object.
 
virtual int32_t hashCode ()
 Return hash code for this object.
 
virtual bool equals (const LuceneObjectPtr &other)
 Return whether two objects are equal.
 
virtual int32_t compareTo (const LuceneObjectPtr &other)
 Compare two objects.
 
virtual String toString ()
 Returns a string representation of the object.
 
- Public Member Functions inherited from Lucene::LuceneSync
virtual ~LuceneSync ()
 
virtual SynchronizePtr getSync ()
 Return this object synchronize lock.
 
virtual LuceneSignalPtr getSignal ()
 Return this object signal.
 
virtual void lock (int32_t timeout=0)
 Lock this object using an optional timeout.
 
virtual void unlock ()
 Unlock this object.
 
virtual bool holdsLock ()
 Returns true if this object is currently locked by current thread.
 
virtual void wait (int32_t timeout=0)
 Wait for signal using an optional timeout.
 
virtual void notifyAll ()
 Notify all threads waiting for signal.
 

Static Public Member Functions

static String _getClassName ()
 
static Collection< InsanityPtrcheckSanity (const FieldCachePtr &cache)
 Quick and dirty convenience method.
 
static Collection< InsanityPtrcheckSanity (Collection< FieldCacheEntryPtr > cacheEntries)
 Quick and dirty convenience method that instantiates an instance with "good defaults" and uses it to test the CacheEntrys.
 

Protected Member Functions

Collection< InsanityPtrcheckValueMismatch (MapSetIntFieldCacheEntry valIdToItems, MapSetReaderFieldInt readerFieldToValIds, SetReaderField valMismatchKeys)
 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.
 
Collection< InsanityPtrcheckSubreaders (MapSetIntFieldCacheEntry valIdToItems, MapSetReaderFieldInt readerFieldToValIds)
 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.
 
Collection< LuceneObjectPtrgetAllDecendentReaderKeys (const LuceneObjectPtr &seed)
 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 obj.getFieldCacheKey()
 
- Protected Member Functions inherited from Lucene::LuceneObject
 LuceneObject ()
 

Additional Inherited Members

- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

Detailed Description

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.

See also
FieldCache
FieldCacheSanityChecker.Insanity
FieldCacheSanityChecker.InsanityType

Member Typedef Documentation

◆ MapSetIntFieldCacheEntry

typedef MapOfSets< int32_t, boost::hash<int32_t>, std::equal_to<int32_t>, FieldCacheEntryPtr, luceneHash<FieldCacheEntryPtr>, luceneEquals<FieldCacheEntryPtr> > Lucene::FieldCacheSanityChecker::MapSetIntFieldCacheEntry

◆ MapSetReaderFieldInt

typedef MapOfSets< ReaderFieldPtr, luceneHash<ReaderFieldPtr>, luceneEquals<ReaderFieldPtr>, int32_t, boost::hash<int32_t>, std::equal_to<int32_t> > Lucene::FieldCacheSanityChecker::MapSetReaderFieldInt

◆ MapSetReaderFieldReaderField

Member Enumeration Documentation

◆ InsanityType

An Enumeration of the different types of "insane" behaviour that may be detected in a FieldCache.

Enumerator
SUBREADER 

Indicates an overlap in cache usage on a given field in sub/super readers.

VALUEMISMATCH 

Indicates entries have the same reader+fieldname but different cached values. This can happen if different datatypes, or parsers are used – and while it's not necessarily a bug it's typically an indication of a possible problem.

NOTE: Only the reader, fieldname, and cached value are actually tested – if two cache entries have different parsers or datatypes but the cached values are the same Object (== not just equal()) this method does not consider that a red flag. This allows for subtle variations in the way a Parser is specified (null vs DEFAULT_LONG_PARSER, etc...)

EXPECTED 

Indicates an expected bit of "insanity". This may be useful for clients that wish to preserve/log information about insane usage but indicate that it was expected.

Constructor & Destructor Documentation

◆ FieldCacheSanityChecker()

Lucene::FieldCacheSanityChecker::FieldCacheSanityChecker ( )

◆ ~FieldCacheSanityChecker()

virtual Lucene::FieldCacheSanityChecker::~FieldCacheSanityChecker ( )
virtual

Member Function Documentation

◆ _getClassName()

static String Lucene::FieldCacheSanityChecker::_getClassName ( )
inlinestatic

◆ check()

Collection< InsanityPtr > Lucene::FieldCacheSanityChecker::check ( Collection< FieldCacheEntryPtr cacheEntries)

Tests a CacheEntry[] for indication of "insane" cache usage. NOTE: FieldCache CreationPlaceholder objects are ignored.

◆ checkSanity() [1/2]

static Collection< InsanityPtr > Lucene::FieldCacheSanityChecker::checkSanity ( Collection< FieldCacheEntryPtr cacheEntries)
static

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

See also
check

◆ checkSanity() [2/2]

static Collection< InsanityPtr > Lucene::FieldCacheSanityChecker::checkSanity ( const FieldCachePtr cache)
static

Quick and dirty convenience method.

See also
check

◆ checkSubreaders()

Collection< InsanityPtr > Lucene::FieldCacheSanityChecker::checkSubreaders ( MapSetIntFieldCacheEntry  valIdToItems,
MapSetReaderFieldInt  readerFieldToValIds 
)
protected

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.

See also
InsanityType::SUBREADER

◆ checkValueMismatch()

Collection< InsanityPtr > Lucene::FieldCacheSanityChecker::checkValueMismatch ( MapSetIntFieldCacheEntry  valIdToItems,
MapSetReaderFieldInt  readerFieldToValIds,
SetReaderField  valMismatchKeys 
)
protected

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.

See also
InsanityType::VALUEMISMATCH

◆ getAllDecendentReaderKeys()

Collection< LuceneObjectPtr > Lucene::FieldCacheSanityChecker::getAllDecendentReaderKeys ( const LuceneObjectPtr seed)
protected

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 obj.getFieldCacheKey()

◆ getClassName()

virtual String Lucene::FieldCacheSanityChecker::getClassName ( )
inlinevirtual

◆ shared_from_this()

boost::shared_ptr< FieldCacheSanityChecker > Lucene::FieldCacheSanityChecker::shared_from_this ( )
inline

The documentation for this class was generated from the following file:

clucene.sourceforge.net