Scanner s = connector.createScanner(opts.tableName, opts.auths);
s.setBatchSize(scanOpts.scanBatchSize);
Key startKey = new Key(encodeLong(opts.start), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), CF_BYTES, CQ_BYTES, new byte[0], 0);
s.setBatchSize(50000);
s.setRange(new Range(startKey, stopKey));
for (Entry<Key,Value> entry : s) {
System.err.println("ERROR : saw entries in range that should be deleted ( first value : " + entry.getValue().toString() + ")");
System.err.println("exiting...");
System.exit(1);
}
} else if (opts.mode.equals("verify")) {
long t1 = System.currentTimeMillis();
Scanner s = connector.createScanner(opts.tableName, opts.auths);
Key startKey = new Key(encodeLong(opts.start), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), CF_BYTES, CQ_BYTES, new byte[0], 0);
s.setBatchSize(scanOpts.scanBatchSize);
s.setRange(new Range(startKey, stopKey));
long i = opts.start;
for (Entry<Key,Value> e : s) {
Key k = e.getKey();
Value v = e.getValue();
// System.out.println("v = "+v);
checkKeyValue(i, k, v);
i++;
}
if (i != opts.start + opts.num) {
System.err.println("ERROR : did not see expected number of rows, saw " + (i - opts.start) + " expected " + opts.num);
System.err.println("exiting... ARGHHHHHH");
System.exit(1);
}
long t2 = System.currentTimeMillis();
System.out.printf("time : %9.2f secs%n", ((t2 - t1) / 1000.0));
System.out.printf("rate : %9.2f entries/sec%n", opts.num / ((t2 - t1) / 1000.0));
} else if (opts.mode.equals("randomLookups")) {
int numLookups = 1000;
Random r = new Random();
long t1 = System.currentTimeMillis();
for (int i = 0; i < numLookups; i++) {
long row = ((r.nextLong() & 0x7fffffffffffffffl) % opts.num) + opts.start;
Scanner s = connector.createScanner(opts.tableName, opts.auths);
s.setBatchSize(scanOpts.scanBatchSize);
Key startKey = new Key(encodeLong(row), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
Key stopKey = new Key(encodeLong(row), CF_BYTES, CQ_BYTES, new byte[0], 0);
s.setRange(new Range(startKey, stopKey));
Iterator<Entry<Key,Value>> si = s.iterator();
if (si.hasNext()) {
Entry<Key,Value> e = si.next();