Class AvailableSpaceVolumeChoosingPolicy<V extends FsVolumeSpi>
java.lang.Object
org.apache.hadoop.hdfs.server.datanode.fsdataset.AvailableSpaceVolumeChoosingPolicy<V>
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable,VolumeChoosingPolicy<V>
public class AvailableSpaceVolumeChoosingPolicy<V extends FsVolumeSpi>
extends Object
implements 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.
Use fine-grained locks to enable choosing volumes of different storage
types concurrently.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchooseVolume(List<V> volumes, long replicaSize, String storageId) Choose a volume to place a replica, given a list of volumes and the replica size sought for storage.org.apache.hadoop.conf.ConfigurationgetConf()voidsetConf(org.apache.hadoop.conf.Configuration conf)
-
Constructor Details
-
AvailableSpaceVolumeChoosingPolicy
public AvailableSpaceVolumeChoosingPolicy()
-
-
Method Details
-
setConf
public void setConf(org.apache.hadoop.conf.Configuration conf) - Specified by:
setConfin interfaceorg.apache.hadoop.conf.Configurable
-
getConf
public org.apache.hadoop.conf.Configuration getConf()- Specified by:
getConfin interfaceorg.apache.hadoop.conf.Configurable
-
chooseVolume
Description copied from interface:VolumeChoosingPolicyChoose a volume to place a replica, given a list of volumes and the replica size sought for storage. The caller should synchronize access to the list of volumes.- Specified by:
chooseVolumein interfaceVolumeChoosingPolicy<V extends FsVolumeSpi>- Parameters:
volumes- - a list of available volumes.replicaSize- - the size of the replica for which a volume is sought.storageId- - the storage id of the Volume nominated by the namenode. This can usually be ignored by the VolumeChoosingPolicy.- Returns:
- the chosen volume.
- Throws:
IOException- when disks are unavailable or are full.
-