Author: ecn
Date: Wed Jan 30 16:01:08 2013
New Revision: 1440490

URL: http://svn.apache.org/viewvc?rev=1440490&view=rev
Log:
ACCUMULO-1004 fix intermittent failure BloomFilterTest

Modified:
    
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java

Modified: 
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java
URL: 
http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java?rev=1440490&r1=1440489&r2=1440490&view=diff
==============================================================================
--- 
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java
 (original)
+++ 
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java
 Wed Jan 30 16:01:08 2013
@@ -67,9 +67,9 @@ public class BloomFilterTest extends Fun
   
   @Override
   public void run() throws Exception {
-    write("bt1", 1, 0, 1000000000, 10000);
-    write("bt2", 2, 0, 1000000000, 10000);
-    write("bt3", 3, 0, 1000000000, 10000);
+    write("bt1", 1, 0, 1000000000, 1000);
+    write("bt2", 2, 0, 1000000000, 1000);
+    write("bt3", 3, 0, 1000000000, 1000);
     
     // test inserting an empty key
     BatchWriter bw = getConnector().createBatchWriter("bt4", new 
BatchWriterConfig());
@@ -79,45 +79,47 @@ public class BloomFilterTest extends Fun
     bw.close();
     getConnector().tableOperations().flush("bt4", null, null, true);
     
-    // ensure minor compactions are finished
+    for (String table : new String[]{"bt1", "bt2", "bt3"}) {
+      getConnector().tableOperations().setProperty(table, 
Property.TABLE_INDEXCACHE_ENABLED.getKey(), "false");
+      getConnector().tableOperations().setProperty(table, 
Property.TABLE_BLOCKCACHE_ENABLED.getKey(), "false");
+      getConnector().tableOperations().flush(table, null, null, true);
+      getConnector().tableOperations().compact(table, null, null, false, true);
+    }
+    
+    // ensure compactions are finished
     super.checkRFiles("bt1", 1, 1, 1, 1);
     super.checkRFiles("bt2", 1, 1, 1, 1);
     super.checkRFiles("bt3", 1, 1, 1, 1);
     super.checkRFiles("bt4", 1, 1, 1, 1);
     
     // these queries should only run quickly if bloom filters are working, so 
lets get a base
-    long t1 = query("bt1", 1, 0, 1000000000, 100000, 10000);
-    long t2 = query("bt2", 2, 0, 1000000000, 100000, 10000);
-    long t3 = query("bt3", 3, 0, 1000000000, 100000, 10000);
+    long t1 = query("bt1", 1, 0, 1000000000, 100000, 1000);
+    long t2 = query("bt2", 2, 0, 1000000000, 100000, 1000);
+    long t3 = query("bt3", 3, 0, 1000000000, 100000, 1000);
     
     getConnector().tableOperations().setProperty("bt1", 
Property.TABLE_BLOOM_ENABLED.getKey(), "true");
     getConnector().tableOperations().setProperty("bt1", 
Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(), 
"org.apache.accumulo.core.file.keyfunctor.RowFunctor");
-    getConnector().tableOperations().compact("bt1", null, null, false, false);
+    getConnector().tableOperations().compact("bt1", null, null, false, true);
     
     getConnector().tableOperations().setProperty("bt2", 
Property.TABLE_BLOOM_ENABLED.getKey(), "true");
     getConnector().tableOperations().setProperty("bt2", 
Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(),
         "org.apache.accumulo.core.file.keyfunctor.ColumnFamilyFunctor");
-    getConnector().tableOperations().compact("bt2", null, null, false, false);
+    getConnector().tableOperations().compact("bt2", null, null, false, true);
     
     getConnector().tableOperations().setProperty("bt3", 
Property.TABLE_BLOOM_ENABLED.getKey(), "true");
     getConnector().tableOperations().setProperty("bt3", 
Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(),
         "org.apache.accumulo.core.file.keyfunctor.ColumnQualifierFunctor");
-    getConnector().tableOperations().compact("bt3", null, null, false, false);
+    getConnector().tableOperations().compact("bt3", null, null, false, true);
     
     getConnector().tableOperations().setProperty("bt4", 
Property.TABLE_BLOOM_ENABLED.getKey(), "true");
     getConnector().tableOperations().setProperty("bt4", 
Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(), 
"org.apache.accumulo.core.file.keyfunctor.RowFunctor");
-    getConnector().tableOperations().compact("bt4", null, null, false, false);
-    
-    Thread.sleep(200);
+    getConnector().tableOperations().compact("bt4", null, null, false, true);
     
-    ZooStore<Master> zs = new 
ZooStore<Master>(ZooUtil.getRoot(getConnector().getInstance()) + 
Constants.ZFATE, ZooReaderWriter.getRetryingInstance());
-    while (!zs.list().isEmpty())
-      Thread.sleep(1000);
     // these queries should only run quickly if bloom
     // filters are working
-    long tb1 = query("bt1", 1, 0, 1000000000, 100000, 10000);
-    long tb2 = query("bt2", 2, 0, 1000000000, 100000, 10000);
-    long tb3 = query("bt3", 3, 0, 1000000000, 100000, 10000);
+    long tb1 = query("bt1", 1, 0, 1000000000, 100000, 1000);
+    long tb2 = query("bt2", 2, 0, 1000000000, 100000, 1000);
+    long tb3 = query("bt3", 3, 0, 1000000000, 100000, 1000);
     
     timeCheck(t1, tb1);
     timeCheck(t2, tb2);
@@ -135,7 +137,7 @@ public class BloomFilterTest extends Fun
   
   private void timeCheck(long t1, long t2) throws Exception {
     if (((t1 - t2) * 1.0 / t1) < .1) {
-      throw new Exception("Queries had less than 10% improvement (old: " + t1 
+ " new: " + t2 + " improvement: " + ((t1 - t2) * 1.0 / t1) + "%)");
+      throw new Exception("Queries had less than 10% improvement (old: " + t1 
+ " new: " + t2 + " improvement: " + ((t1 - t2) * 100. / t1) + "%)");
     }
   }
   


Reply via email to