lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1402822 - in /lucene/dev/trunk/solr: CHANGES.txt core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
Date Sat, 27 Oct 2012 17:04:19 GMT
Author: markrmiller
Date: Sat Oct 27 17:04:19 2012
New Revision: 1402822

URL: http://svn.apache.org/viewvc?rev=1402822&view=rev
Log:
SOLR-4001: In CachingDirectoryFactory#close, if there are still refs for a Directory outstanding,
we need to wait for them to be released before closing.

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1402822&r1=1402821&r2=1402822&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Sat Oct 27 17:04:19 2012
@@ -125,6 +125,10 @@ Bug Fixes
 * SOLR-3998: Atomic update on uniqueKey field itself causes duplicate document.
   (Eric Spencer, yonik)
 
+* SOLR-4001: In CachingDirectoryFactory#close, if there are still refs for a
+  Directory outstanding, we need to wait for them to be released before closing.
+  (Mark Miller)
+
 Other Changes
 ----------------------
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java?rev=1402822&r1=1402821&r2=1402822&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
(original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
Sat Oct 27 17:04:19 2012
@@ -111,6 +111,17 @@ public abstract class CachingDirectoryFa
     synchronized (this) {
       for (CacheValue val : byDirectoryCache.values()) {
         try {
+          // if there are still refs out, we have to wait for them
+          int cnt = 0;
+          while(val.refCnt != 0) {
+            wait(100);
+            
+            if (cnt++ >= 100*10*30) {
+              log.error("Timeout waiting for all directory ref counts to be released");
+              break;
+            }
+          }
+          
           assert val.refCnt == 0 : val.refCnt;
           val.directory.close();
         } catch (Throwable t) {



Mime
View raw message