Class PreferredVolumeChooser

java.lang.Object
org.apache.accumulo.core.spi.fs.RandomVolumeChooser
org.apache.accumulo.core.spi.fs.PreferredVolumeChooser
All Implemented Interfaces:
VolumeChooser
Direct Known Subclasses:
SpaceAwareVolumeChooser

public class PreferredVolumeChooser extends RandomVolumeChooser
A RandomVolumeChooser that selects preferred volumes to use from the provided volume options. Preferred Volumes are set on either the per-table, per-scope, or default configuration level. Configuration details are overridden based on the top-down "Default","Site","System" scopes.

Defaults to selecting a volume at random from the provided volume options.

Property Details:

Preferred volumes can be set on a per-table basis via the custom property volume.preferred.

This property should contain a comma separated list of Volume URIs. Since this is a custom property, it can be accessed under the prefix table.custom.
The volume.preferred property can be set at various configuration levels depending on the scope. Note: Both the property name and the format of its value are specific to this particular implementation.

Scope Property Lookups and Defaults locations
Scope Property Value Lookup Default Property Lookup
Scope.DEFAULT general.custom.volume.preferred.default Throws RuntimeException if not set
Scope.INIT general.custom.volume.preferred.init general.custom.volume.preferred.default
Scope.LOGGER general.custom.volume.preferred.logger general.custom.volume.preferred.default
Scope.TABLE table.custom.volume.preferred general.custom.volume.preferred.default

Examples of expected usage:

  • Separate metadata table and write ahead logs from general data location.
     
     // Set list of volumes
     instance.volumes=hdfs://namenode_A/accumulo,hdfs://namenode_B/general
     // Enable the preferred volume chooser
     general.volume.chooser=org.apache.accumulo.core.spi.fs.PreferredVolumeChooser
     // Set default preferred volume
     general.custom.volume.preferred.default=hdfs://namenode_B/general
     // Set write-ahead log preferred volume
     general.custom.volume.preferred.logger=hdfs://namenode_A/accumulo
     // Initialize and start accumulo
     // Once accumulo is up, open the shell and configure the metadata table to use a preferred volume
     config -t accumulo.metadata -s table.custom.volume.preferred=hdfs://namenode_A/accumulo
     
     
  • Allow general data to use all volumes, but limit a specific table to a preferred volume
     
     // Set list of volumes
     instance.volumes=hdfs://namenode/accumulo,hdfs://namenode/accumulo_select
     // Enable the preferred volume chooser
     general.volume.chooser=org.apache.accumulo.core.spi.fs.PreferredVolumeChooser
     // Set default preferred volumes
     general.custom.volume.preferred.default=hdfs://namenode/accumulo,hdfs://namenode/accumulo_select
     // Initialize and start accumulo
     // Once accumulo is up, open the shell and configure the metadata table to use a preferred volume
     config -t accumulo.metadata -s table.custom.volume.preferred=hdfs://namenode/accumulo_select
     
     
Since:
2.1.0
  • Constructor Details

    • PreferredVolumeChooser

      public PreferredVolumeChooser()
  • Method Details

    • choose

      public String choose(VolumeChooserEnvironment env, Set<String> options)
      Description copied from class: RandomVolumeChooser
      Selects a volume at random from the provided set of volumes. The environment scope is not utilized.
      Specified by:
      choose in interface VolumeChooser
      Overrides:
      choose in class RandomVolumeChooser
      Parameters:
      env - the server environment provided by the calling framework
      options - the list of volumes to choose from
      Returns:
      a volume from the list of volume options
    • choosable

      public Set<String> choosable(VolumeChooserEnvironment env, Set<String> options)
      Returns the subset of volumes that match the defined preferred volumes value
      Specified by:
      choosable in interface VolumeChooser
      Overrides:
      choosable in class RandomVolumeChooser
      Parameters:
      env - the server environment provided by the calling framework
      options - the subset of volumes to choose from
      Returns:
      an array of preferred volumes that are a subset of Property.INSTANCE_VOLUMES