[ 
https://issues.apache.org/jira/browse/LUCENE-1798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12747538#action_12747538
 ] 

Hoss Man commented on LUCENE-1798:
----------------------------------

Michael: reading the patch you commited, i only have two concerns...

1) a PrintStream doesn't really seem like the ideal callback API for this 
situation ... with IndexWriter it makes some sense because we ant to be able to 
log all sorts of misc info that will be unstructured, but in the field cache 
checkign case we already have a fairly robust data structure (Insanity) that we 
can provide ... so instead of a setInfoStream(PritStream) method, why not have 
a callback interface that takes Insanity objects (and the Entry that triggered 
the problem)

{code}
  /** 
   * If non-null, this monitor will be notify anytime an entry is created 
   * which are not sane according to {...@link FieldCacheSanityChecker}.
   * @param monitor The Monitor to notify, if it throws a RuntimeException then 
the cache method will throw a RuntimeException.
   */
  public void setInsanityMonitor(InsanityMonitor monitor)
  ...
  public interface InsanityMonitor {
    public void notify(CacheEntry e, Instanty[] i);
  }
{code}

2) it seems like we should change LuceneTestCase to use this new hook instead 
of just calling the FieldCacheSanityChecker in tearDown() ... that way we can 
be sure we're checking all FieldCache usages (the current approach risks 
IndexReader weak refs getting gc'ed after they go out of scope in the test and 
before the checker runs in tearDown)


....thoughts?


> FieldCacheSanityChecker called directly by FieldCache.get*
> ----------------------------------------------------------
>
>                 Key: LUCENE-1798
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1798
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>            Reporter: Hoss Man
>            Assignee: Michael McCandless
>             Fix For: 2.9
>
>         Attachments: LUCENE-1798.patch, LUCENE-1798.patch
>
>
> As suggested by McCandless in LUCENE-1749, we can make FieldCacheImpl a 
> client of the FieldCacheSanityChecker and have it sanity check itself each 
> time it creates a new cache entry, and log a warning if it thinks there is a 
> problem.  (although we'd probably only want to do this if the caller has set 
> some sort of infoStream/warningStream type property on the FieldCache object.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to