incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/3] git commit: Fixes due to some unit test failures.
Date Tue, 23 Jul 2013 00:13:04 GMT
Fixes due to some unit test failures.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/31917a95
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/31917a95
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/31917a95

Branch: refs/heads/master
Commit: 31917a953857810c5a0b82402db42728ced252e5
Parents: f9f6d39
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Jul 22 20:12:11 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Jul 22 20:12:11 2013 -0400

----------------------------------------------------------------------
 .../org/apache/blur/thrift/BlurClusterTest.java | 24 ++++++++++++++------
 .../blur/lucene/search/IterablePaging.java      |  3 +++
 2 files changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/31917a95/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java b/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java
index daa144a..29fb0ba 100644
--- a/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java
+++ b/blur-core/src/test/java/org/apache/blur/thrift/BlurClusterTest.java
@@ -65,7 +65,8 @@ import org.junit.Test;
 
 public class BlurClusterTest {
 
-  private static final long _20MB = 20 * 1000 * 1000;
+  private static final int _1MB = 1000 * 1000;
+  private static final int _20MB = 20 * _1MB;
   private static final File TMPDIR = new File(System.getProperty("blur.tmp.dir", "./target/tmp_BlurClusterTest"));
 
   @BeforeClass
@@ -185,7 +186,7 @@ public class BlurClusterTest {
     }).start();
     Thread.sleep(500);
     client.cancelQuery("test", blurQueryRow.getUuid());
-    BlurException blurException = pollForError(error, 10, TimeUnit.SECONDS);
+    BlurException blurException = pollForError(error, 10, TimeUnit.SECONDS, null);
     if (fail.get()) {
       fail("Unknown error, failing test.");
     }
@@ -235,26 +236,35 @@ public class BlurClusterTest {
       }
     }).start();
     Thread.sleep(500);
-    byte[] bufferToPutGcWatcherOverLimit = new byte[(int) _20MB];
-    BlurException blurException = pollForError(error, 10, TimeUnit.SECONDS);
+    List<byte[]> bufferToPutGcWatcherOverLimitList = new ArrayList<byte[]>();
+    BlurException blurException = pollForError(error, 10, TimeUnit.SECONDS, bufferToPutGcWatcherOverLimitList);
     if (fail.get()) {
       fail("Unknown error, failing test.");
     }
     System.out.println(bufferToFillHeap.hashCode());
-    System.out.println(bufferToPutGcWatcherOverLimit.hashCode());
+    System.out.println(bufferToPutGcWatcherOverLimitList.hashCode());
     assertEquals(blurException.getErrorType(), ErrorType.BACK_PRESSURE);
+    bufferToPutGcWatcherOverLimitList.clear();
+    bufferToPutGcWatcherOverLimitList = null;
+    bufferToFillHeap = null;
   }
 
-  private BlurException pollForError(AtomicReference<BlurException> error, long period,
TimeUnit timeUnit)
-      throws InterruptedException {
+  private BlurException pollForError(AtomicReference<BlurException> error, long period,
TimeUnit timeUnit,
+      List<byte[]> bufferToPutGcWatcherOverLimitList) throws InterruptedException {
     long s = System.nanoTime();
     long totalTime = timeUnit.toNanos(period) + s;
+    if (bufferToPutGcWatcherOverLimitList != null) {
+      bufferToPutGcWatcherOverLimitList.add(new byte[_1MB * 5]);
+    }
     while (totalTime > System.nanoTime()) {
       BlurException blurException = error.get();
       if (blurException != null) {
         return blurException;
       }
       Thread.sleep(500);
+      if (bufferToPutGcWatcherOverLimitList != null) {
+        bufferToPutGcWatcherOverLimitList.add(new byte[_1MB * 5]);
+      }
     }
     return null;
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/31917a95/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java b/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java
index 1ae8f5b..a050ee9 100644
--- a/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java
+++ b/blur-query/src/main/java/org/apache/blur/lucene/search/IterablePaging.java
@@ -21,6 +21,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
+import org.apache.blur.index.ExitableReader.ExitingReaderException;
 import org.apache.blur.lucene.search.StopExecutionCollector.StopExecutionCollectorException;
 import org.apache.blur.thrift.BException;
 import org.apache.blur.thrift.generated.BlurException;
@@ -194,6 +195,8 @@ public class IterablePaging implements BlurIterable<ScoreDoc, BlurException>
{
         scoreDocs = topDocs.scoreDocs;
       } catch (StopExecutionCollectorException e) {
         throw new BlurException(STOP_EXECUTION_COLLECTOR_EXCEPTION, null, ErrorType.UNKNOWN);
+      } catch (ExitingReaderException e) {
+        throw new BlurException(STOP_EXECUTION_COLLECTOR_EXCEPTION, null, ErrorType.UNKNOWN);
       } catch (IOException e) {
         throw new BException("Unknown error during search call", e);
       }


Mime
View raw message