in src/main/java/org/apache/accumulo/testing/randomwalk/image/TableOp.java [36:79]
public void visit(State state, RandWalkEnv env, Properties props) throws Exception {
// choose a table
String tableName;
if (env.getRandom().nextInt(10) < 8) {
tableName = state.getString("imageTableName");
} else {
tableName = state.getString("indexTableName");
}
// check if chosen table exists
AccumuloClient client = env.getAccumuloClient();
TableOperations tableOps = client.tableOperations();
if (!tableOps.exists(tableName)) {
log.error("Table " + tableName + " does not exist!");
return;
}
// choose a random action
if (env.getRandom().nextInt(10) > 6) {
log.debug("Retrieving info for " + tableName);
tableOps.getLocalityGroups(tableName);
tableOps.getProperties(tableName);
tableOps.listSplits(tableName);
tableOps.list();
} else {
log.debug("Clearing locator cache for " + tableName);
tableOps.clearLocatorCache(tableName);
}
if (env.getRandom().nextInt(10) < 3) {
Map<String,Set<Text>> groups = tableOps.getLocalityGroups(state.getString("imageTableName"));
if (groups.isEmpty()) {
log.debug("Adding locality groups to " + state.getString("imageTableName"));
groups = ImageFixture.getLocalityGroups();
} else {
log.debug("Removing locality groups from " + state.getString("imageTableName"));
groups = new HashMap<>();
}
tableOps.setLocalityGroups(state.getString("imageTableName"), groups);
}
}