in src/main/java/org/apache/accumulo/testing/stress/Write.java [28:79]
public static void main(String[] args) throws Exception {
WriteOptions opts = new WriteOptions();
opts.parseArgs(Write.class.getName(), args);
opts.check();
try (AccumuloClient c = Accumulo.newClient().from(opts.getClientProps()).build()) {
if (opts.clear_table && c.tableOperations().exists(opts.tableName)) {
try {
c.tableOperations().delete(opts.tableName);
} catch (TableNotFoundException e) {
System.err.println("Couldn't delete the table because it doesn't exist any more.");
}
}
if (!c.tableOperations().exists(opts.tableName)) {
try {
c.tableOperations().create(opts.tableName);
} catch (TableExistsException e) {
System.err.println("Couldn't create table ourselves, but that's ok. Continuing.");
}
}
long writeDelay = opts.write_delay;
if (writeDelay < 0) {
writeDelay = 0;
}
try (DataWriter dw = new DataWriter(c.createBatchWriter(opts.tableName), new RandomMutations(
// rows
new RandomByteArrays(new RandomWithinRange(opts.row_seed, opts.rowMin(), opts.rowMax())),
// cfs
new RandomByteArrays(new RandomWithinRange(opts.cf_seed, opts.cfMin(), opts.cfMax())),
// cqs
new RandomByteArrays(new RandomWithinRange(opts.cq_seed, opts.cqMin(), opts.cqMax())),
// vals
new RandomByteArrays(
new RandomWithinRange(opts.value_seed, opts.valueMin(), opts.valueMax())),
// number of cells per row
new RandomWithinRange(opts.row_width_seed, opts.rowWidthMin(), opts.rowWidthMax()),
// max cells per mutation
opts.max_cells_per_mutation))) {
while (true) {
dw.next();
if (writeDelay > 0) {
Thread.sleep(writeDelay);
}
}
}
}
}