Class DiskBalancerVolumeSet

java.lang.Object
org.apache.hadoop.hdfs.server.diskbalancer.datamodel.DiskBalancerVolumeSet

public class DiskBalancerVolumeSet extends Object
DiskBalancerVolumeSet is a collection of storage devices on the data node which are of similar StorageType.
  • 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

      public DiskBalancerVolumeSet(DiskBalancerVolumeSet volumeSet)
      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

      public String getStorageType()
      Get Storage Type.
      Returns:
      String
    • setStorageType

      public void setStorageType(String typeOfStorage)
      Set Storage Type.
      Parameters:
      typeOfStorage - -- StorageType
    • addVolume

      public void addVolume(DiskBalancerVolume volume) throws Exception
      adds a given volume into this volume set.
      Parameters:
      volume - - volume to add.
      Throws:
      Exception
    • getVolumes

      public List<DiskBalancerVolume> getVolumes()
      Returns a list diskVolumes that are part of this volume set.
      Returns:
      List
    • getSortedQueue

      public TreeSet<DiskBalancerVolume> 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

      public void removeVolume(DiskBalancerVolume volume)
      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

      public String getSetID()
      Get Volume Set ID.
      Returns:
      String
    • setSetID

      public void setSetID(String volID)
      Set VolumeSet ID.
      Parameters:
      volID - String
    • getIdealUsed

      public double getIdealUsed()
      Gets the idealUsed for this volume set.