lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r950451 - in /lucene/java/branches/lucene_2_9: ./ contrib/ contrib/analyzers/ contrib/highlighter/src/test/ contrib/instantiated/src/test/org/apache/lucene/store/instantiated/ src/java/org/apache/lucene/analysis/ src/java/org/apache/lucene/...
Date Wed, 02 Jun 2010 09:33:57 GMT
Author: mikemccand
Date: Wed Jun  2 09:33:57 2010
New Revision: 950451

URL: http://svn.apache.org/viewvc?rev=950451&view=rev
Log:
LUCENE-2135: forcefully purge FieldCache when reader is closed

Modified:
    lucene/java/branches/lucene_2_9/   (props changed)
    lucene/java/branches/lucene_2_9/CHANGES.txt   (contents, props changed)
    lucene/java/branches/lucene_2_9/build.xml   (props changed)
    lucene/java/branches/lucene_2_9/contrib/   (props changed)
    lucene/java/branches/lucene_2_9/contrib/CHANGES.txt   (props changed)
    lucene/java/branches/lucene_2_9/contrib/analyzers/   (props changed)
    lucene/java/branches/lucene_2_9/contrib/highlighter/src/test/   (props changed)
    lucene/java/branches/lucene_2_9/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/analysis/Tokenizer.java   (props
changed)
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/DirectoryReader.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FilterIndexReader.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/MultiReader.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/ParallelReader.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/SegmentReader.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/FieldCache.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/FieldCacheImpl.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/AttributeSource.java 
 (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestDateTools.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestNumberTools.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/   (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
  (props changed)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/TestAttributeSource.java
  (props changed)

Propchange: lucene/java/branches/lucene_2_9/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -2,4 +2,4 @@
 /lucene/dev/trunk/lucene:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_2_4:748824
 /lucene/java/branches/lucene_3_0:886275,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk:821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk:821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,886257,887347,887532,887670,889431-889432,889579,889866,890439,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Modified: lucene/java/branches/lucene_2_9/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/CHANGES.txt?rev=950451&r1=950450&r2=950451&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/CHANGES.txt (original)
+++ lucene/java/branches/lucene_2_9/CHANGES.txt Wed Jun  2 09:33:57 2010
@@ -3,6 +3,12 @@ $Id$
 
 ======================= 2.9 branch (not yet released) ==================
 
+Changes in backwards compatibility policy
+
+* LUCENE-2135: Added FieldCache.purge(IndexReader) method to the
+  interface.  Anyone implementing FieldCache externally will need to
+  fix their code to implement this, on upgrading.  (Mike McCandless)
+
 Changes in runtime behavior
 
 * LUCENE-2421: NativeFSLockFactory does not throw LockReleaseFailedException if 
@@ -87,6 +93,10 @@ API Changes
 
 Optimizations
 
+* LUCENE-2135: On IndexReader.close, forcefully evict any entries from
+  the FieldCache rather than waiting for the WeakHashMap to release
+  the reference (Mike McCandless)
+
 * LUCENE-2161: Improve concurrency of IndexReader, especially in the
   context of near real-time readers.  (Mike McCandless)
 

Propchange: lucene/java/branches/lucene_2_9/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/CHANGES.txt:941394,946651,948430
 /lucene/dev/trunk/lucene/CHANGES.txt:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/CHANGES.txt:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/CHANGES.txt:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/CHANGES.txt:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,889866,890439,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Propchange: lucene/java/branches/lucene_2_9/build.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/build.xml:941394,946651,948430
 /lucene/dev/trunk/lucene/build.xml:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/build.xml:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/build.xml:821888,834035,836155,887670,889431-889432,889579,891205,891209,891377,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/build.xml:821888,834035,836155,887670,889431-889432,889579,889866,890439,891205,891209,891377,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Propchange: lucene/java/branches/lucene_2_9/contrib/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/contrib:941394,946651,948430
 /lucene/dev/trunk/lucene/contrib:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/contrib:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/contrib:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/contrib:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,889866,890439,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Propchange: lucene/java/branches/lucene_2_9/contrib/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt:941394,946651,948430
 /lucene/dev/trunk/lucene/contrib/CHANGES.txt:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/contrib/CHANGES.txt:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/contrib/CHANGES.txt:821888,834035,836155,887670,889431-889432,889579,891205,891209,891377,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/contrib/CHANGES.txt:821888,834035,836155,887670,889431-889432,889579,889866,890439,891205,891209,891377,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Propchange: lucene/java/branches/lucene_2_9/contrib/analyzers/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/contrib/analyzers:941394,946651
 /lucene/dev/trunk/lucene/contrib/analyzers:939611,940730
 /lucene/java/branches/lucene_3_0/contrib/analyzers:950301
-/lucene/java/trunk/contrib/analyzers:834035,836155,887670,889579,891205,891377,920270
+/lucene/java/trunk/contrib/analyzers:834035,836155,887670,889579,889866,890439,891205,891377,920270

Propchange: lucene/java/branches/lucene_2_9/contrib/highlighter/src/test/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/contrib/highlighter/src/test:941394,946651,948430
 /lucene/dev/trunk/lucene/contrib/highlighter/src/test:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/contrib/highlighter/src/test:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/contrib/highlighter/src/test:821888,834035,836155,887670,889431-889432,889579,891205,891209,891377,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/contrib/highlighter/src/test:821888,834035,836155,887670,889431-889432,889579,889866,890439,891205,891209,891377,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Propchange: lucene/java/branches/lucene_2_9/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -4,4 +4,4 @@
 /lucene/java/branches/lucene_2_9/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:817269-818599
 /lucene/java/branches/lucene_2_9_back_compat_tests/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:818601-821336
 /lucene/java/branches/lucene_3_0/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:889463,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:821888,834035,836155,881213,881315,881466,881819,882374,882672,882807,882888,882977,883074-883075,883554,884870,886257,886911,887347,887532,887602,887670,888247,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java:821888,834035,836155,881213,881315,881466,881819,882374,882672,882807,882888,882977,883074-883075,883554,884870,886257,886911,887347,887532,887602,887670,888247,889431-889432,889579,889866,890439,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Propchange: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/analysis/Tokenizer.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/analysis/Tokenizer.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/java/org/apache/lucene/analysis/Tokenizer.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/analysis/Tokenizer.java:889688,891211,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/src/java/org/apache/lucene/analysis/Tokenizer.java:821888,834035,836155,887670,889579,891205,891377,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/src/java/org/apache/lucene/analysis/Tokenizer.java:821888,834035,836155,887670,889579,889866,890439,891205,891377,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/DirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/DirectoryReader.java?rev=950451&r1=950450&r2=950451&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/DirectoryReader.java
(original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/DirectoryReader.java
Wed Jun  2 09:33:57 2010
@@ -35,7 +35,7 @@ import org.apache.lucene.search.DefaultS
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.Lock;
 import org.apache.lucene.store.LockObtainFailedException;
-import org.apache.lucene.store.AlreadyClosedException;
+import org.apache.lucene.search.FieldCache; // not great (circular); used only to purge FieldCache
entry on close
 
 /** 
  * An IndexReader which reads indexes with multiple segments.
@@ -811,6 +811,12 @@ class DirectoryReader extends IndexReade
         if (ioe == null) ioe = e;
       }
     }
+
+    // NOTE: only needed in case someone had asked for
+    // FieldCache for top-level reader (which is generally
+    // not a good idea):
+    FieldCache.DEFAULT.purge(this);
+
     // throw the first exception
     if (ioe != null) throw ioe;
   }

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FilterIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FilterIndexReader.java?rev=950451&r1=950450&r2=950451&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FilterIndexReader.java
(original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FilterIndexReader.java
Wed Jun  2 09:33:57 2010
@@ -20,6 +20,7 @@ package org.apache.lucene.index;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.FieldSelector;
 import org.apache.lucene.store.Directory;
+import org.apache.lucene.search.FieldCache; // not great (circular); used only to purge FieldCache
entry on close
 
 import java.io.IOException;
 import java.util.Collection;
@@ -216,8 +217,14 @@ public class FilterIndexReader extends I
   
   protected void doCommit(Map commitUserData) throws IOException { in.commit(commitUserData);
}
   
-  protected void doClose() throws IOException { in.close(); }
+  protected void doClose() throws IOException {
+    in.close();
 
+    // NOTE: only needed in case someone had asked for
+    // FieldCache for top-level reader (which is generally
+    // not a good idea):
+    FieldCache.DEFAULT.purge(this);
+  }
 
   public Collection getFieldNames(IndexReader.FieldOption fieldNames) {
     ensureOpen();
@@ -242,4 +249,11 @@ public class FilterIndexReader extends I
   public IndexReader[] getSequentialSubReaders() {
     return in.getSequentialSubReaders();
   }
+
+  /** If the subclass of FilteredIndexReader modifies the
+   *  contents of the FieldCache, you must override this
+   *  method to provide a different key */
+  public Object getFieldCacheKey() {
+    return in.getFieldCacheKey();
+  }
 }

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/MultiReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/MultiReader.java?rev=950451&r1=950450&r2=950451&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/MultiReader.java (original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/MultiReader.java Wed
Jun  2 09:33:57 2010
@@ -29,6 +29,7 @@ import org.apache.lucene.index.Directory
 import org.apache.lucene.index.DirectoryReader.MultiTermEnum;
 import org.apache.lucene.index.DirectoryReader.MultiTermPositions;
 import org.apache.lucene.search.DefaultSimilarity;
+import org.apache.lucene.search.FieldCache; // not great (circular); used only to purge FieldCache
entry on close
 
 /** An IndexReader which reads multiple indexes, appending their content.
  *
@@ -375,6 +376,11 @@ public class MultiReader extends IndexRe
         subReaders[i].close();
       }
     }
+
+    // NOTE: only needed in case someone had asked for
+    // FieldCache for top-level reader (which is generally
+    // not a good idea):
+    FieldCache.DEFAULT.purge(this);
   }
   
   public Collection getFieldNames (IndexReader.FieldOption fieldNames) {

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/ParallelReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/ParallelReader.java?rev=950451&r1=950450&r2=950451&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/ParallelReader.java (original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/ParallelReader.java Wed
Jun  2 09:33:57 2010
@@ -21,6 +21,7 @@ import org.apache.lucene.document.Docume
 import org.apache.lucene.document.FieldSelector;
 import org.apache.lucene.document.FieldSelectorResult;
 import org.apache.lucene.document.Fieldable;
+import org.apache.lucene.search.FieldCache; // not great (circular); used only to purge FieldCache
entry on close
 
 import java.io.IOException;
 import java.util.*;
@@ -453,6 +454,8 @@ public class ParallelReader extends Inde
         ((IndexReader)readers.get(i)).close();
       }
     }
+
+    FieldCache.DEFAULT.purge(this);
   }
 
   public Collection getFieldNames (IndexReader.FieldOption fieldNames) {

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/SegmentReader.java?rev=950451&r1=950450&r2=950451&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/SegmentReader.java (original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/SegmentReader.java Wed
Jun  2 09:33:57 2010
@@ -37,6 +37,7 @@ import org.apache.lucene.store.IndexInpu
 import org.apache.lucene.store.IndexOutput;
 import org.apache.lucene.util.BitVector;
 import org.apache.lucene.util.CloseableThreadLocal;
+import org.apache.lucene.search.FieldCache; // not great (circular); used only to purge FieldCache
entry on close
 
 /** @version $Id */
 /**
@@ -92,13 +93,15 @@ public class SegmentReader extends Index
     final int readBufferSize;
     final int termsIndexDivisor;
 
+    private final SegmentReader origInstance;
+
     TermInfosReader tis;
     FieldsReader fieldsReaderOrig;
     TermVectorsReader termVectorsReaderOrig;
     CompoundFileReader cfsReader;
     CompoundFileReader storeCFSReader;
 
-    CoreReaders(Directory dir, SegmentInfo si, int readBufferSize, int termsIndexDivisor)
throws IOException {
+    CoreReaders(SegmentReader origInstance, Directory dir, SegmentInfo si, int readBufferSize,
int termsIndexDivisor) throws IOException {
       segment = si.name;
       this.readBufferSize = readBufferSize;
       this.dir = dir;
@@ -139,6 +142,12 @@ public class SegmentReader extends Index
           decRef();
         }
       }
+
+      // Must assign this at the end -- if we hit an
+      // exception above core, we don't want to attempt to
+      // purge the FieldCache (will hit NPE because core is
+      // not assigned yet).
+      this.origInstance = origInstance;
     }
 
     synchronized TermVectorsReader getTermVectorsReaderOrig() {
@@ -232,6 +241,11 @@ public class SegmentReader extends Index
         if (storeCFSReader != null) {
           storeCFSReader.close();
         }
+
+        // Force FieldCache to evict our entries at this point
+        if (freqStream != null) {
+          FieldCache.DEFAULT.purge(origInstance);
+        }
       }
     }
 
@@ -635,7 +649,7 @@ public class SegmentReader extends Index
     boolean success = false;
 
     try {
-      instance.core = new CoreReaders(dir, si, readBufferSize, termInfosIndexDivisor);
+      instance.core = new CoreReaders(instance, dir, si, readBufferSize, termInfosIndexDivisor);
       if (doOpenStores) {
         instance.core.openDocStores(si);
       }

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/FieldCache.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/FieldCache.java?rev=950451&r1=950450&r2=950451&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/FieldCache.java (original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/FieldCache.java Wed
Jun  2 09:33:57 2010
@@ -617,6 +617,15 @@ public interface FieldCache {
   public abstract void purgeAllCaches();
 
   /**
+   * Expert: drops all cache entries associated with this
+   * reader.  NOTE: this reader must precisely match the
+   * reader that the cache entry is keyed on. If you pass a
+   * top-level reader, it usually will have no effect as
+   * Lucene now caches at the segment reader level.
+   */
+  public abstract void purge(IndexReader r);
+
+  /**
    * If non-null, FieldCacheImpl will warn whenever
    * entries are created that are not sane according to
    * {@link org.apache.lucene.util.FieldCacheSanityChecker}.

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/FieldCacheImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/FieldCacheImpl.java?rev=950451&r1=950450&r2=950451&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/FieldCacheImpl.java
(original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/FieldCacheImpl.java
Wed Jun  2 09:33:57 2010
@@ -68,6 +68,14 @@ class FieldCacheImpl implements Extended
   public void purgeAllCaches() {
     init();
   }
+
+  public void purge(IndexReader r) {
+    Iterator it = caches.values().iterator();
+    while(it.hasNext()) {
+      Cache c = (Cache) it.next();
+      c.purge(r);
+    }
+  }
   
   public CacheEntry[] getCacheEntries() {
     List result = new ArrayList(17);
@@ -183,6 +191,14 @@ class FieldCacheImpl implements Extended
     protected abstract Object createValue(IndexReader reader, Entry key)
         throws IOException;
 
+    /** Remove this reader from the cache, if present. */
+    public void purge(IndexReader r) {
+      Object readerKey = r.getFieldCacheKey();
+      synchronized(readerCache) {
+        readerCache.remove(readerKey);
+      }
+    }
+
     public Object get(IndexReader reader, Entry key) throws IOException {
       Map innerCache;
       Object value;

Propchange: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,889866,890439,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Propchange: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/util/AttributeSource.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -2,4 +2,4 @@
 /lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/AttributeSource.java:929738,932398,935522,940730,946599,949976,949997
 /lucene/java/branches/lucene_2_4/src/java/org/apache/lucene/util/AttributeSource.java:748824
 /lucene/java/branches/lucene_3_0/src/java/org/apache/lucene/util/AttributeSource.java:886275,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/src/java/org/apache/lucene/util/AttributeSource.java:821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,886257,887347,887532,887670,889579,891189,891205,891363,894348,897672,908975,910034,910078,912407,919060,920270
+/lucene/java/trunk/src/java/org/apache/lucene/util/AttributeSource.java:821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,886257,887347,887532,887670,889579,889866,890439,891189,891205,891363,894348,897672,908975,910034,910078,912407,919060,920270

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -2,4 +2,4 @@
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:929738,932398,935522,940730,946599,949976,949997
 /lucene/java/branches/lucene_2_4/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:748824
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:886275,889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:818920,821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,887347,887532,887670,889579,891189,891205,891363,897672,908975,910034,910078,912407,919060,920270
+/lucene/java/trunk/src/test/org/apache/lucene/analysis/BaseTokenStreamTestCase.java:818920,821888,824125,826029,826385,830871,833095,833297,833886,834035,836155,881819,882672,883554,884870,887347,887532,887670,889579,889866,890439,891189,891205,891363,897672,908975,910034,910078,912407,919060,920270

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,889866,890439,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestDateTools.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/document/TestDateTools.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestDateTools.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/document/TestDateTools.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/src/test/org/apache/lucene/document/TestDateTools.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/src/test/org/apache/lucene/document/TestDateTools.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,889866,890439,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/document/TestNumberTools.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/document/TestNumberTools.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestNumberTools.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/document/TestNumberTools.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/src/test/org/apache/lucene/document/TestNumberTools.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/src/test/org/apache/lucene/document/TestNumberTools.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,889866,890439,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index:941394,946651
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/index:940730
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/index:950301
-/lucene/java/trunk/src/test/org/apache/lucene/index:834035,836155,887670,889579,891205,891377,920270
+/lucene/java/trunk/src/test/org/apache/lucene/index:834035,836155,887670,889579,889866,890439,891205,891377,920270

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,889866,890439,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/util/TestAttributeSource.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  2 09:33:57 2010
@@ -1,4 +1,4 @@
 /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java:941394,946651,948430
 /lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/TestAttributeSource.java:929738,932398,935522,938989,939611,939649,940730,946599,948082,948429,949976,949997
 /lucene/java/branches/lucene_3_0/src/test/org/apache/lucene/util/TestAttributeSource.java:889688,891211,899639,900212,908479,909401,912383,915404,940993,948090,948432,950033,950301
-/lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270
+/lucene/java/trunk/src/test/org/apache/lucene/util/TestAttributeSource.java:821888,834035,836155,881819,886257,887347,887532,887670,889431-889432,889579,889866,890439,891189,891205,891209,891363,891377,897672,899627,900196,908477,908975,909398,910034,910078,912407,915399,919060,920270



Mime
View raw message