Search in sources :

Example 1 with PreferredVolumeChooser

use of org.apache.accumulo.server.fs.PreferredVolumeChooser in project accumulo by apache.

the class VolumeChooserFailureIT method missingVolumePreferredVolumeChooser.

// Test that uses one table with 10 split points each. It uses the PreferredVolumeChooser, but no preferred volume is specified.
// This means that the volume chooser will fail and no instance volumes will be assigned.
@Test
public void missingVolumePreferredVolumeChooser() throws Exception {
    log.info("Starting missingVolumePreferredVolumeChooser");
    // Create namespace
    Connector connector = getConnector();
    connector.namespaceOperations().create(namespace1);
    // Set properties on the namespace
    connector.namespaceOperations().setProperty(namespace1, PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, PreferredVolumeChooser.class.getName());
    // deliberately do not set preferred volumes
    // Create table1 on namespace1 (will fail)
    String tableName = namespace1 + ".1";
    thrown.expect(AccumuloException.class);
    connector.tableOperations().create(tableName);
}
Also used : Connector(org.apache.accumulo.core.client.Connector) PreferredVolumeChooser(org.apache.accumulo.server.fs.PreferredVolumeChooser) Test(org.junit.Test)

Example 2 with PreferredVolumeChooser

use of org.apache.accumulo.server.fs.PreferredVolumeChooser in project accumulo by apache.

the class VolumeChooserIT method twoTablesPreferredVolumeChooser.

// Test that uses two tables with 10 split points each. They each use the PreferredVolumeChooser to choose volumes.
@Test
public void twoTablesPreferredVolumeChooser() throws Exception {
    log.info("Starting twoTablesPreferredVolumeChooser");
    // Create namespace
    Connector connector = getConnector();
    connector.namespaceOperations().create(namespace1);
    // Set properties on the namespace
    // namespace 1 -> v2
    connector.namespaceOperations().setProperty(namespace1, PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, PreferredVolumeChooser.class.getName());
    connector.namespaceOperations().setProperty(namespace1, PreferredVolumeChooser.TABLE_PREFERRED_VOLUMES, v2.toString());
    // Create table1 on namespace1
    verifyVolumesForWritesToNewTable(connector, namespace1, v2.toString());
    connector.namespaceOperations().create(namespace2);
    // Set properties on the namespace
    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());
}
Also used : Connector(org.apache.accumulo.core.client.Connector) PreferredVolumeChooser(org.apache.accumulo.server.fs.PreferredVolumeChooser) Test(org.junit.Test)

Aggregations

Connector (org.apache.accumulo.core.client.Connector)2 PreferredVolumeChooser (org.apache.accumulo.server.fs.PreferredVolumeChooser)2 Test (org.junit.Test)2