You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/02/28 23:56:39 UTC

svn commit: r1294882 - /lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocValuesIndexing.java

Author: mikemccand
Date: Tue Feb 28 22:56:39 2012
New Revision: 1294882

URL: http://svn.apache.org/viewvc?rev=1294882&view=rev
Log:
LUCENE-3829: fix test to use DV API correctly

Modified:
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocValuesIndexing.java

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocValuesIndexing.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocValuesIndexing.java?rev=1294882&r1=1294881&r2=1294882&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocValuesIndexing.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestDocValuesIndexing.java Tue Feb 28 22:56:39 2012
@@ -872,10 +872,6 @@ public class TestDocValuesIndexing exten
     
     final AtomicReader sr = getOnlySegmentReader(r);
     final DocValues dv = sr.docValues("stringdv");
-    final DocValues.Source stringDVSource = dv.getSource();
-    assertNotNull(stringDVSource);
-    final DocValues.Source stringDVDirectSource = dv.getDirectSource();
-    assertNotNull(stringDVDirectSource);
     assertNotNull(dv);
 
     final long END_TIME = System.currentTimeMillis() + (TEST_NIGHTLY ? 30 : 1);
@@ -888,11 +884,19 @@ public class TestDocValuesIndexing exten
       threads[thread] = new Thread() {
           @Override
           public void run() {
+            final DocValues.Source stringDVSource;
+            final DocValues.Source stringDVDirectSource;
+            try {
+              stringDVSource = dv.getSource();
+              assertNotNull(stringDVSource);
+              stringDVDirectSource = dv.getDirectSource();
+              assertNotNull(stringDVDirectSource);
+            } catch (IOException ioe) {
+              throw new RuntimeException(ioe);
+            }
             while(System.currentTimeMillis() < END_TIME) {
               final DocValues.Source source;
-              // LUCENE-3829: remove this 'true ||' below
-              // once we fix thread safety of DirectSource
-              if (true || random.nextBoolean()) {
+              if (random.nextBoolean()) {
                 source = stringDVSource;
               } else {
                 source = stringDVDirectSource;
@@ -914,6 +918,10 @@ public class TestDocValuesIndexing exten
       threads[thread].start();
     }
 
+    for(Thread thread : threads) {
+      thread.join();
+    }
+
     r.close();
     dir.close();
   }