lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r988736 - /lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
Date Tue, 24 Aug 2010 21:55:32 GMT
Author: mikemccand
Date: Tue Aug 24 21:55:32 2010
New Revision: 988736

URL: http://svn.apache.org/viewvc?rev=988736&view=rev
Log:
sync CMS to address intermittent failure

Modified:
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java?rev=988736&r1=988735&r2=988736&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
(original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
Tue Aug 24 21:55:32 2010
@@ -24,6 +24,8 @@ import org.apache.lucene.index.IndexRead
 import org.apache.lucene.index.Term;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
+import org.apache.lucene.index.MergeScheduler;
+import org.apache.lucene.index.ConcurrentMergeScheduler;
 import org.apache.lucene.index.RandomIndexWriter;
 import org.apache.lucene.index.SlowMultiReaderWrapper;
 import org.apache.lucene.store.Directory;
@@ -160,6 +162,14 @@ public class TestCachingWrapperFilter ex
     Directory dir = newDirectory(rand);
     RandomIndexWriter writer = new RandomIndexWriter(rand, dir);
 
+    MergeScheduler ms = writer.w.getMergeScheduler();
+    ConcurrentMergeScheduler cms;
+    if (ms instanceof ConcurrentMergeScheduler) {
+      cms = (ConcurrentMergeScheduler) ms;
+    } else {
+      cms = null;
+    }
+
     // NOTE: cannot use writer.getReader because RIW (on
     // flipping a coin) may give us a newly opened reader,
     // but we use .reopen on this reader below and expect to
@@ -172,6 +182,9 @@ public class TestCachingWrapperFilter ex
     doc.add(new Field("id", "1", Field.Store.YES, Field.Index.NOT_ANALYZED));
     writer.addDocument(doc);
 
+    if (cms != null) {
+      cms.sync();
+    }
     reader = refreshReader(reader);
     searcher = new IndexSearcher(reader);
 
@@ -192,6 +205,9 @@ public class TestCachingWrapperFilter ex
     // now delete the doc, refresh the reader, and see that it's not there
     writer.deleteDocuments(new Term("id", "1"));
 
+    if (cms != null) {
+      cms.sync();
+    }
     reader = refreshReader(reader);
     searcher = new IndexSearcher(reader);
 
@@ -206,6 +222,10 @@ public class TestCachingWrapperFilter ex
     filter = new CachingWrapperFilter(startFilter, CachingWrapperFilter.DeletesMode.RECACHE);
 
     writer.addDocument(doc);
+
+    if (cms != null) {
+      cms.sync();
+    }
     reader = refreshReader(reader);
     searcher = new IndexSearcher(reader);
         
@@ -218,6 +238,9 @@ public class TestCachingWrapperFilter ex
 
     // make sure we get a cache hit when we reopen reader
     // that had no change to deletions
+    if (cms != null) {
+      cms.sync();
+    }
     IndexReader newReader = refreshReader(reader);
     assertTrue(reader != newReader);
     reader = newReader;
@@ -230,6 +253,9 @@ public class TestCachingWrapperFilter ex
     // now delete the doc, refresh the reader, and see that it's not there
     writer.deleteDocuments(new Term("id", "1"));
 
+    if (cms != null) {
+      cms.sync();
+    }
     reader = refreshReader(reader);
     searcher = new IndexSearcher(reader);
 
@@ -245,6 +271,9 @@ public class TestCachingWrapperFilter ex
     filter = new CachingWrapperFilter(startFilter, CachingWrapperFilter.DeletesMode.DYNAMIC);
 
     writer.addDocument(doc);
+    if (cms != null) {
+      cms.sync();
+    }
     reader = refreshReader(reader);
     searcher = new IndexSearcher(reader);
         
@@ -257,6 +286,9 @@ public class TestCachingWrapperFilter ex
     // now delete the doc, refresh the reader, and see that it's not there
     writer.deleteDocuments(new Term("id", "1"));
 
+    if (cms != null) {
+      cms.sync();
+    }
     reader = refreshReader(reader);
     searcher = new IndexSearcher(reader);
 



Mime
View raw message