org.apache.hadoop.hdfs.server.datanode.fsdataset
Class AvailableSpaceVolumeChoosingPolicy<V extends FsVolumeSpi>

java.lang.Object
  extended by org.apache.hadoop.hdfs.server.datanode.fsdataset.AvailableSpaceVolumeChoosingPolicy<V>
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable, org.apache.hadoop.hdfs.server.datanode.fsdataset.VolumeChoosingPolicy<V>

public class AvailableSpaceVolumeChoosingPolicy<V extends FsVolumeSpi>
extends Object
implements org.apache.hadoop.hdfs.server.datanode.fsdataset.VolumeChoosingPolicy<V>, org.apache.hadoop.conf.Configurable

A DN volume choosing policy which takes into account the amount of free space on each of the available volumes when considering where to assign a new replica allocation. By default this policy prefers assigning replicas to those volumes with more available free space, so as to over time balance the available space of all the volumes within a DN.


Constructor Summary
AvailableSpaceVolumeChoosingPolicy()
           
 
Method Summary
 V chooseVolume(List<V> volumes, long replicaSize)
          Choose a volume to place a replica, given a list of volumes and the replica size sought for storage.
 org.apache.hadoop.conf.Configuration getConf()
           
 void setConf(org.apache.hadoop.conf.Configuration conf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvailableSpaceVolumeChoosingPolicy

public AvailableSpaceVolumeChoosingPolicy()
Method Detail

setConf

public void setConf(org.apache.hadoop.conf.Configuration conf)
Specified by:
setConf in interface org.apache.hadoop.conf.Configurable

getConf

public org.apache.hadoop.conf.Configuration getConf()
Specified by:
getConf in interface org.apache.hadoop.conf.Configurable

chooseVolume

public V chooseVolume(List<V> volumes,
                      long replicaSize)
                                   throws IOException
Description copied from interface: org.apache.hadoop.hdfs.server.datanode.fsdataset.VolumeChoosingPolicy
Choose a volume to place a replica, given a list of volumes and the replica size sought for storage. The implementations of this interface must be thread-safe.

Specified by:
chooseVolume in interface org.apache.hadoop.hdfs.server.datanode.fsdataset.VolumeChoosingPolicy<V extends FsVolumeSpi>
Parameters:
volumes - - a list of available volumes.
replicaSize - - the size of the replica for which a volume is sought.
Returns:
the chosen volume.
Throws:
IOException - when disks are unavailable or are full.


Copyright © 2014 Apache Software Foundation. All Rights Reserved.