You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2013/11/18 21:34:59 UTC

git commit: ACCUMULO-1892 redo resolving conflict resolution from 1.4 merge

Updated Branches:
  refs/heads/1.5.1-SNAPSHOT a7c5b72d3 -> 60dd8bd73


ACCUMULO-1892 redo resolving conflict resolution from 1.4 merge


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/60dd8bd7
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/60dd8bd7
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/60dd8bd7

Branch: refs/heads/1.5.1-SNAPSHOT
Commit: 60dd8bd732ce0596150e49ae06fa7605aa0a15fd
Parents: a7c5b72
Author: Keith Turner <kt...@apache.org>
Authored: Mon Nov 18 15:18:04 2013 -0500
Committer: Keith Turner <kt...@apache.org>
Committed: Mon Nov 18 15:20:40 2013 -0500

----------------------------------------------------------------------
 .../examples/simple/client/RandomBatchWriter.java       | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/60dd8bd7/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java
----------------------------------------------------------------------
diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java
index 845d67d..ce91da6 100644
--- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java
+++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java
@@ -123,6 +123,7 @@ public class RandomBatchWriter {
     opts.parseArgs(RandomBatchWriter.class.getName(), args, bwOpts);
     if ((opts.max - opts.min) < opts.num) {
       System.err.println(String.format("You must specify a min and a max that allow for at least num possible values. For example, you requested %d rows, but a min of %d and a max of %d only allows for %d rows.", opts.num, opts.min, opts.max, (opts.max - opts.min)));
+      System.exit(1);
     }
     Random r;
     if (opts.seed == null)
@@ -130,15 +131,18 @@ public class RandomBatchWriter {
     else {
       r = new Random(opts.seed);
     }
-    
     Connector connector = opts.getConnector();
     BatchWriter bw = connector.createBatchWriter(opts.tableName, bwOpts.getBatchWriterConfig());
     
     // reuse the ColumnVisibility object to improve performance
     ColumnVisibility cv = opts.visiblity;
-    
-    for (int i = 0; i < opts.num; i++) {  
-      long rowid = (Math.abs(r.nextLong()) % (opts.max - opts.min)) + opts.min;
+   
+    // Generate num unique row ids in the given range
+    HashSet<Long> rowids = new HashSet<Long>(opts.num);
+    while (rowids.size() < opts.num) {
+      rowids.add((Math.abs(r.nextLong()) % (opts.max - opts.min)) + opts.min);
+    }
+    for (long rowid : rowids) {
       Mutation m = createMutation(rowid, opts.size, cv);
       bw.addMutation(m);
     }