lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r920270 - /lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
Date Mon, 08 Mar 2010 11:08:26 GMT
Author: mikemccand
Date: Mon Mar  8 11:08:26 2010
New Revision: 920270

URL: http://svn.apache.org/viewvc?rev=920270&view=rev
Log:
LUCENE-2300: don't pool readers on external directories when IW

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java?rev=920270&r1=920269&r2=920270&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java Mon Mar  8 11:08:26
2010
@@ -477,7 +477,8 @@
 
       assert !pooled | readerMap.get(sr.getSegmentInfo()) == sr;
 
-      // Drop caller's ref
+      // Drop caller's ref; for an external reader (not
+      // pooled), this decRef will close it
       sr.decRef();
 
       if (pooled && (drop || (!poolReaders && sr.getRefCount() == 1))) {
@@ -613,7 +614,11 @@
         // synchronized
         // Returns a ref, which we xfer to readerMap:
         sr = SegmentReader.get(false, info.dir, info, readBufferSize, doOpenStores, termsIndexDivisor);
-        readerMap.put(info, sr);
+
+        if (info.dir == directory) {
+          // Only pool if reader is not external
+          readerMap.put(info, sr);
+        }
       } else {
         if (doOpenStores) {
           sr.openDocStores();
@@ -630,7 +635,10 @@
       }
 
       // Return a ref to our caller
-      sr.incRef();
+      if (info.dir == directory) {
+        // Only incRef if we pooledd (reader is not external)
+        sr.incRef();
+      }
       return sr;
     }
 



Mime
View raw message