Class DiskBalancerVolumeSet
java.lang.Object
org.apache.hadoop.hdfs.server.diskbalancer.datamodel.DiskBalancerVolumeSet
DiskBalancerVolumeSet is a collection of storage devices on the
data node which are of similar StorageType.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs Empty DiskNBalanceVolumeSet.DiskBalancerVolumeSet(boolean isTransient) Constructs a DiskBalancerVolumeSet.DiskBalancerVolumeSet(DiskBalancerVolumeSet volumeSet) Constructs a new DiskBalancerVolumeSet. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVolume(DiskBalancerVolume volume) adds a given volume into this volume set.voidComputes Volume Data Density.doubleGets the idealUsed for this volume set.getSetID()Get Volume Set ID.Get Storage Type.intReturns the number of volumes in the Volume Set.Returns a list diskVolumes that are part of this volume set.booleanisBalancingNeeded(double thresholdPercentage) Computes whether we need to do any balancing on this volume Set at all.booleanTells us if this volumeSet is transient.voidremoveVolume(DiskBalancerVolume volume) Remove a volume from the current set.voidSet VolumeSet ID.voidsetStorageType(String typeOfStorage) Set Storage Type.voidsetTransient(boolean transientValue) Set the transient properties for this volumeSet.
-
Constructor Details
-
DiskBalancerVolumeSet
public DiskBalancerVolumeSet()Constructs Empty DiskNBalanceVolumeSet. This is needed by jackson -
DiskBalancerVolumeSet
public DiskBalancerVolumeSet(boolean isTransient) Constructs a DiskBalancerVolumeSet.- Parameters:
isTransient- - boolean
-
DiskBalancerVolumeSet
Constructs a new DiskBalancerVolumeSet.
-
-
Method Details
-
isTransient
public boolean isTransient()Tells us if this volumeSet is transient.- Returns:
- - true or false
-
setTransient
public void setTransient(boolean transientValue) Set the transient properties for this volumeSet.- Parameters:
transientValue- - Boolean
-
computeVolumeDataDensity
public void computeVolumeDataDensity()Computes Volume Data Density. Adding a new volume changes the volumeDataDensity for all volumes. So we throw away our priority queue and recompute everything. we discard failed volumes from this computation. totalCapacity = totalCapacity of this volumeSet totalUsed = totalDfsUsed for this volumeSet idealUsed = totalUsed / totalCapacity dfsUsedRatio = dfsUsedOnAVolume / Capacity On that Volume volumeDataDensity = idealUsed - dfsUsedRatio -
getVolumeCount
public int getVolumeCount()Returns the number of volumes in the Volume Set.- Returns:
- int
-
getStorageType
Get Storage Type.- Returns:
- String
-
setStorageType
Set Storage Type.- Parameters:
typeOfStorage- -- StorageType
-
addVolume
adds a given volume into this volume set.- Parameters:
volume- - volume to add.- Throws:
Exception
-
getVolumes
Returns a list diskVolumes that are part of this volume set.- Returns:
- List
-
getSortedQueue
-
isBalancingNeeded
public boolean isBalancingNeeded(double thresholdPercentage) Computes whether we need to do any balancing on this volume Set at all. It checks if any disks are out of threshold value- Parameters:
thresholdPercentage- - threshold - in percentage- Returns:
- true if balancing is needed false otherwise.
-
removeVolume
Remove a volume from the current set. This call does not recompute the volumeDataDensity. It has to be done manually after this call.- Parameters:
volume- - Volume to remove
-
getSetID
Get Volume Set ID.- Returns:
- String
-
setSetID
Set VolumeSet ID.- Parameters:
volID- String
-
getIdealUsed
public double getIdealUsed()Gets the idealUsed for this volume set.
-