accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1469628 - in /accumulo/trunk: ./ test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/
Date Thu, 18 Apr 2013 23:05:53 GMT
Author: vines
Date: Thu Apr 18 23:05:52 2013
New Revision: 1469628

URL: http://svn.apache.org/r1469628
Log:
ACCUMULO-1304 - infinite start and ends



Modified:
    accumulo/trunk/   (props changed)
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Compact.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java

Propchange: accumulo/trunk/
------------------------------------------------------------------------------
  Merged /accumulo/branches/1.5:r1469531-1469627

Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Compact.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Compact.java?rev=1469628&r1=1469627&r2=1469628&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Compact.java
(original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Compact.java
Thu Apr 18 23:05:52 2013
@@ -19,7 +19,6 @@ package org.apache.accumulo.test.randomw
 import java.util.List;
 import java.util.Properties;
 import java.util.Random;
-import java.util.TreeSet;
 
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.TableNotFoundException;
@@ -41,20 +40,16 @@ public class Compact extends Test {
     
     String tableName = tableNames.get(rand.nextInt(tableNames.size()));
     
-    // TODO need to sometimes do null start and end ranges - ACCUMULO-1304
-    
-    TreeSet<Text> range = new TreeSet<Text>();
-    range.add(new Text(String.format("%016x", rand.nextLong() & 0x7fffffffffffffffl)));
-    range.add(new Text(String.format("%016x", rand.nextLong() & 0x7fffffffffffffffl)));
+    List<Text> range = ConcurrentFixture.generateRange(rand);
     
     try {
       boolean wait = rand.nextBoolean();
-      conn.tableOperations().compact(tableName, range.first(), range.last(), false, wait);
-      log.debug((wait ? "compacted " : "initiated compaction ") + tableName);
+      conn.tableOperations().compact(tableName, range.get(0), range.get(1), false, wait);
+      log.debug((wait ? "compacted " : "initiated compaction ") + tableName + " from " +
range.get(0) + " to " + range.get(1));
     } catch (TableNotFoundException tne) {
-      log.debug("compact " + tableName + " failed, doesnt exist");
+      log.debug("compact " + tableName + " from " + range.get(0) + " to " + range.get(1)
+ " failed, doesnt exist");
     } catch (TableOfflineException toe) {
-      log.debug("compact " + tableName + " failed, offline");
+      log.debug("compact " + tableName + " from " + range.get(0) + " to " + range.get(1)
+ " failed, offline");
     }
     
   }

Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java?rev=1469628&r1=1469627&r2=1469628&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
(original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
Thu Apr 18 23:05:52 2013
@@ -16,8 +16,13 @@
  */
 package org.apache.accumulo.test.randomwalk.concurrent;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
 import org.apache.accumulo.test.randomwalk.Fixture;
 import org.apache.accumulo.test.randomwalk.State;
+import org.apache.hadoop.io.Text;
 
 /**
  * When multiple instance of this test suite are run, all instances will operate on the same
set of table names.
@@ -33,4 +38,37 @@ public class ConcurrentFixture extends F
   @Override
   public void tearDown(State state) throws Exception {}
   
+  /**
+   * 
+   * @param rand
+   *  A Random to use
+   * @return
+   *  A two element list with first being smaller than the second, but either value (or both)
can be null
+   */
+  public static List<Text> generateRange(Random rand) {
+    ArrayList<Text> toRet = new ArrayList<Text>(2);
+
+    long firstLong = rand.nextLong();
+    
+    
+    long secondLong = rand.nextLong();
+    Text first = null, second = null;
+    
+    // Having all negative values = null might be too frequent
+    if (firstLong >= 0)
+      first = new Text(String.format("%016x", firstLong & 0x7fffffffffffffffl));
+    if (secondLong >= 0)
+      second = new Text(String.format("%016x", secondLong & 0x7fffffffffffffffl));
+
+    if (first != null && second != null && first.compareTo(second) > 0)
{
+      Text swap = first;
+      first = second;
+      second = swap;
+    }
+    
+    toRet.add(first);
+    toRet.add(second);
+    
+    return toRet;
+  }
 }

Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java?rev=1469628&r1=1469627&r2=1469628&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java
(original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java
Thu Apr 18 23:05:52 2013
@@ -20,7 +20,6 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
 import java.util.Random;
-import java.util.TreeSet;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Connector;
@@ -43,20 +42,16 @@ public class Merge extends Test {
     tableNames = new ArrayList<String>(tableNames);
     tableNames.add(Constants.METADATA_TABLE_NAME);
     String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-    
-    // TODO need to sometimes do null start and end ranges - ACCUMULO-1304
-    
-    TreeSet<Text> range = new TreeSet<Text>();
-    range.add(new Text(String.format("%016x", rand.nextLong() & 0x7fffffffffffffffl)));
-    range.add(new Text(String.format("%016x", rand.nextLong() & 0x7fffffffffffffffl)));
+        
+    List<Text> range = ConcurrentFixture.generateRange(rand);
     
     try {
-      conn.tableOperations().merge(tableName, range.first(), range.last());
-      log.debug("merged " + tableName);
+      conn.tableOperations().merge(tableName, range.get(0), range.get(1));
+      log.debug("merged " + tableName + " from " + range.get(0) + " to " + range.get(1));
     } catch (TableOfflineException toe) {
-      log.debug("merge " + tableName + " failed, table is not online");
+      log.debug("merge " + tableName + " from " + range.get(0) + " to " + range.get(1) +
" failed, table is not online");
     } catch (TableNotFoundException tne) {
-      log.debug("merge " + tableName + " failed, doesnt exist");
+      log.debug("merge " + tableName + " from " + range.get(0) + " to " + range.get(1) +
" failed, doesnt exist");
     }
     
   }



Mime
View raw message