use of org.apache.accumulo.core.client.Connector in project accumulo by apache.
the class LogicalTimeIT method run.
@Test
public void run() throws Exception {
int tc = 0;
String tableName = getUniqueNames(1)[0];
Connector c = getConnector();
runMergeTest(c, tableName + tc++, new String[] { "m" }, new String[] { "a" }, null, null, "b", 2l);
runMergeTest(c, tableName + tc++, new String[] { "m" }, new String[] { "z" }, null, null, "b", 2l);
runMergeTest(c, tableName + tc++, new String[] { "m" }, new String[] { "a", "z" }, null, null, "b", 2l);
runMergeTest(c, tableName + tc++, new String[] { "m" }, new String[] { "a", "c", "z" }, null, null, "b", 3l);
runMergeTest(c, tableName + tc++, new String[] { "m" }, new String[] { "a", "y", "z" }, null, null, "b", 3l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "a" }, null, null, "b", 2l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "h" }, null, null, "b", 2l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "s" }, null, null, "b", 2l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "a", "h", "s" }, null, null, "b", 2l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "a", "c", "h", "s" }, null, null, "b", 3l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "a", "h", "s", "i" }, null, null, "b", 3l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "t", "a", "h", "s" }, null, null, "b", 3l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "a" }, null, "h", "b", 2l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "h" }, null, "h", "b", 2l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "s" }, null, "h", "b", 1l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "a", "h", "s" }, null, "h", "b", 2l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "a", "c", "h", "s" }, null, "h", "b", 3l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "a", "h", "s", "i" }, null, "h", "b", 3l);
runMergeTest(c, tableName + tc++, new String[] { "g", "r" }, new String[] { "t", "a", "h", "s" }, null, "h", "b", 2l);
}
use of org.apache.accumulo.core.client.Connector in project accumulo by apache.
the class MasterAssignmentIT method test.
@Test
public void test() throws Exception {
Connector c = getConnector();
String tableName = super.getUniqueNames(1)[0];
c.tableOperations().create(tableName);
String tableId = c.tableOperations().tableIdMap().get(tableName);
// wait for the table to be online
TabletLocationState newTablet;
do {
UtilWaitThread.sleep(250);
newTablet = getTabletLocationState(c, tableId);
} while (newTablet.current == null);
assertNull(newTablet.last);
assertNull(newTablet.future);
// put something in it
BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
Mutation m = new Mutation("a");
m.put("b", "c", "d");
bw.addMutation(m);
bw.close();
// give it a last location
c.tableOperations().flush(tableName, null, null, true);
TabletLocationState flushed = getTabletLocationState(c, tableId);
assertEquals(newTablet.current, flushed.current);
assertEquals(flushed.current, flushed.last);
assertNull(newTablet.future);
// take the tablet offline
c.tableOperations().offline(tableName, true);
TabletLocationState offline = getTabletLocationState(c, tableId);
assertNull(offline.future);
assertNull(offline.current);
assertEquals(flushed.current, offline.last);
// put it back online
c.tableOperations().online(tableName, true);
TabletLocationState online = getTabletLocationState(c, tableId);
assertNull(online.future);
assertNotNull(online.current);
assertEquals(online.current, online.last);
}
use of org.apache.accumulo.core.client.Connector in project accumulo by apache.
the class MasterFailoverIT method test.
@Test
public void test() throws Exception {
Connector c = getConnector();
String[] names = getUniqueNames(2);
c.tableOperations().create(names[0]);
TestIngest.Opts opts = new TestIngest.Opts();
opts.setTableName(names[0]);
ClientConfiguration clientConf = cluster.getClientConfig();
if (clientConf.hasSasl()) {
opts.updateKerberosCredentials(clientConf);
} else {
opts.setPrincipal(getAdminPrincipal());
}
TestIngest.ingest(c, opts, new BatchWriterOpts());
ClusterControl control = cluster.getClusterControl();
control.stopAllServers(ServerType.MASTER);
// start up a new one
control.startAllServers(ServerType.MASTER);
// talk to it
c.tableOperations().rename(names[0], names[1]);
VerifyIngest.Opts vopts = new VerifyIngest.Opts();
vopts.setTableName(names[1]);
if (clientConf.hasSasl()) {
vopts.updateKerberosCredentials(clientConf);
} else {
vopts.setPrincipal(getAdminPrincipal());
}
VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
}
use of org.apache.accumulo.core.client.Connector in project accumulo by apache.
the class MaxOpenIT method run.
@Test
public void run() throws Exception {
final Connector c = getConnector();
final String tableName = getUniqueNames(1)[0];
final ClientConfiguration clientConf = cluster.getClientConfig();
c.tableOperations().create(tableName);
c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "10");
c.tableOperations().addSplits(tableName, TestIngest.getSplitPoints(0, NUM_TO_INGEST, NUM_TABLETS));
// the following loop should create three tablets in each map file
for (int i = 0; i < 3; i++) {
TestIngest.Opts opts = new TestIngest.Opts();
opts.timestamp = i;
opts.dataSize = 50;
opts.rows = NUM_TO_INGEST;
opts.cols = 1;
opts.random = i;
opts.setTableName(tableName);
if (clientConf.hasSasl()) {
opts.updateKerberosCredentials(clientConf);
} else {
opts.setPrincipal(getAdminPrincipal());
}
TestIngest.ingest(c, opts, new BatchWriterOpts());
c.tableOperations().flush(tableName, null, null, true);
FunctionalTestUtils.checkRFiles(c, tableName, NUM_TABLETS, NUM_TABLETS, i + 1, i + 1);
}
List<Range> ranges = new ArrayList<>(NUM_TO_INGEST);
for (int i = 0; i < NUM_TO_INGEST; i++) {
ranges.add(new Range(TestIngest.generateRow(i, 0)));
}
long time1 = batchScan(c, tableName, ranges, 1);
// run it again, now that stuff is cached on the client and sever
time1 = batchScan(c, tableName, ranges, 1);
long time2 = batchScan(c, tableName, ranges, NUM_TABLETS);
System.out.printf("Single thread scan time %6.2f %n", time1 / 1000.0);
System.out.printf("Multiple thread scan time %6.2f %n", time2 / 1000.0);
}
use of org.apache.accumulo.core.client.Connector in project accumulo by apache.
the class MergeIT method merge.
@Test
public void merge() throws Exception {
Connector c = getConnector();
String tableName = getUniqueNames(1)[0];
c.tableOperations().create(tableName);
c.tableOperations().addSplits(tableName, splits("a b c d e f g h i j k".split(" ")));
BatchWriter bw = c.createBatchWriter(tableName, null);
for (String row : "a b c d e f g h i j k".split(" ")) {
Mutation m = new Mutation(row);
m.put("cf", "cq", "value");
bw.addMutation(m);
}
bw.close();
c.tableOperations().flush(tableName, null, null, true);
c.tableOperations().merge(tableName, new Text("c1"), new Text("f1"));
assertEquals(8, c.tableOperations().listSplits(tableName).size());
}
Aggregations