incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [44/45] git commit: Making some changes to try and make the back pressure test more stable.
Date Sat, 28 Sep 2013 02:12:30 GMT
Making some changes to try and make the back pressure test more stable.


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

Branch: refs/heads/apache-blur-0.2
Commit: 25fb703a6918bedf7d6c30ee66463031f628d3d3
Parents: 89fa41e
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun Sep 22 10:57:00 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun Sep 22 10:57:00 2013 -0400

----------------------------------------------------------------------
 .../org/apache/blur/thrift/BlurClusterTest.java | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/25fb703a/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 54fe030..39b55bc 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
@@ -66,7 +66,6 @@ import org.junit.Test;
 
 public class BlurClusterTest {
 
-  private static final int _1MB = 1000 * 1000;
   private static final File TMPDIR = new File(System.getProperty("blur.tmp.dir", "./target/tmp_BlurClusterTest"));
   private static MiniCluster miniCluster;
 
@@ -199,7 +198,7 @@ public class BlurClusterTest {
     }).start();
     Thread.sleep(500);
     client.cancelQuery("test", blurQueryRow.getUuid());
-    BlurException blurException = pollForError(error, 10, TimeUnit.SECONDS, null, fail);
+    BlurException blurException = pollForError(error, 10, TimeUnit.SECONDS, null, fail, -1);
     if (fail.get()) {
       fail("Unknown error, failing test.");
     }
@@ -242,7 +241,9 @@ public class BlurClusterTest {
     System.out.println("Limit Heap [" + limit + "]");
     long difference = limit - used;
     int sizeToAllocate = (int) ((int) difference * 0.50);
-    System.out.println("Allocating [" + sizeToAllocate + "] Heap [" + getHeapSize() + "]");
+    System.out.println("Allocating [" + sizeToAllocate + "] Heap [" + getHeapSize() + "]
Max [" + getMaxHeapSize()
+        + "]");
+
     byte[] bufferToFillHeap = new byte[sizeToAllocate];
     new Thread(new Runnable() {
       @Override
@@ -261,7 +262,8 @@ public class BlurClusterTest {
     }).start();
     Thread.sleep(500);
     List<byte[]> bufferToPutGcWatcherOverLimitList = new ArrayList<byte[]>();
-    BlurException blurException = pollForError(error, 120, TimeUnit.SECONDS, bufferToPutGcWatcherOverLimitList,
fail);
+    BlurException blurException = pollForError(error, 120, TimeUnit.SECONDS, bufferToPutGcWatcherOverLimitList,
fail,
+        (int) (difference / 7));
     if (fail.get()) {
       fail("Unknown error, failing test.");
     }
@@ -274,12 +276,13 @@ public class BlurClusterTest {
   }
 
   private BlurException pollForError(AtomicReference<BlurException> error, long period,
TimeUnit timeUnit,
-      List<byte[]> bufferToPutGcWatcherOverLimitList, AtomicBoolean fail) throws InterruptedException
{
+      List<byte[]> bufferToPutGcWatcherOverLimitList, AtomicBoolean fail, int sizeToAllocate)
+      throws InterruptedException {
     long s = System.nanoTime();
     long totalTime = timeUnit.toNanos(period) + s;
-    int sizeToAllocate = _1MB * 10;
     if (bufferToPutGcWatcherOverLimitList != null) {
-      System.out.println("Allocating [" + sizeToAllocate + "] Heap [" + getHeapSize() + "]");
+      System.out.println("Allocating [" + sizeToAllocate + "] Heap [" + getHeapSize() + "]
Max [" + getMaxHeapSize()
+          + "]");
       bufferToPutGcWatcherOverLimitList.add(new byte[sizeToAllocate]);
     }
     while (totalTime > System.nanoTime()) {
@@ -292,7 +295,8 @@ public class BlurClusterTest {
       }
       Thread.sleep(250);
       if (bufferToPutGcWatcherOverLimitList != null) {
-        System.out.println("Allocating [" + sizeToAllocate + "] Heap [" + getHeapSize() +
"]");
+        System.out.println("Allocating [" + sizeToAllocate + "] Heap [" + getHeapSize() +
"] Max [" + getMaxHeapSize()
+            + "]");
         bufferToPutGcWatcherOverLimitList.add(new byte[sizeToAllocate]);
       }
     }
@@ -303,6 +307,10 @@ public class BlurClusterTest {
     return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();
   }
 
+  private long getMaxHeapSize() {
+    return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax();
+  }
+
   public void testTestShardFailover() throws BlurException, TException, InterruptedException,
IOException,
       KeeperException {
     Iface client = getClient();


Mime
View raw message