use of org.apache.accumulo.server.fs.RandomVolumeChooser in project accumulo by apache.
the class VolumeChooserIT method twoTablesRandomVolumeChooser.
// Test that uses two tables with 10 split points each. They each use the RandomVolumeChooser to choose volumes.
@Test
public void twoTablesRandomVolumeChooser() throws Exception {
log.info("Starting twoTablesRandomVolumeChooser()");
// Create namespace
Connector connector = getConnector();
connector.namespaceOperations().create(namespace1);
// Set properties on the namespace
connector.namespaceOperations().setProperty(namespace1, PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, RandomVolumeChooser.class.getName());
// Create table1 on namespace1
String tableName = namespace1 + ".1";
connector.tableOperations().create(tableName);
Table.ID tableID = Table.ID.of(connector.tableOperations().tableIdMap().get(tableName));
// Add 10 splits to the table
addSplits(connector, tableName);
// Write some data to the table
writeAndReadData(connector, tableName);
// Verify the new files are written to the Volumes specified
verifyVolumes(connector, tableName, TabletsSection.getRange(tableID), v1.toString() + "," + v2.toString() + "," + v4.toString());
connector.namespaceOperations().create(namespace2);
// Set properties on the namespace
connector.namespaceOperations().setProperty(namespace2, PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, RandomVolumeChooser.class.getName());
// Create table2 on namespace2
String tableName2 = namespace2 + ".1";
connector.tableOperations().create(tableName2);
Table.ID tableID2 = Table.ID.of(connector.tableOperations().tableIdMap().get(tableName2));
// / Add 10 splits to the table
addSplits(connector, tableName2);
// Write some data to the table
writeAndReadData(connector, tableName2);
// Verify the new files are written to the Volumes specified
verifyVolumes(connector, tableName2, TabletsSection.getRange(tableID2), v1.toString() + "," + v2.toString() + "," + v4.toString());
}
use of org.apache.accumulo.server.fs.RandomVolumeChooser in project accumulo by apache.
the class VolumeChooserIT method twoTablesDiffChoosers.
// Test that uses two tables with 10 split points each. The first uses the RandomVolumeChooser and the second uses the
// StaticVolumeChooser to choose volumes.
@Test
public void twoTablesDiffChoosers() throws Exception {
log.info("Starting twoTablesDiffChoosers");
// Create namespace
Connector connector = getConnector();
connector.namespaceOperations().create(namespace1);
// Set properties on the namespace
connector.namespaceOperations().setProperty(namespace1, PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, RandomVolumeChooser.class.getName());
// Create table1 on namespace1
verifyVolumesForWritesToNewTable(connector, namespace1, v1.toString() + "," + v2.toString() + "," + v4.toString());
connector.namespaceOperations().create(namespace2);
connector.namespaceOperations().setProperty(namespace2, PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, PreferredVolumeChooser.class.getName());
connector.namespaceOperations().setProperty(namespace2, PreferredVolumeChooser.TABLE_PREFERRED_VOLUMES, v1.toString());
// Create table2 on namespace2
verifyVolumesForWritesToNewTable(connector, namespace2, v1.toString());
}
Aggregations