Class StorageLocationChecker

java.lang.Object
org.apache.hadoop.hdfs.server.datanode.checker.StorageLocationChecker

@Private @Unstable public class StorageLocationChecker extends Object
A utility class that encapsulates checking storage locations during DataNode startup. Some of this code was extracted from the DataNode class.
  • Field Details

    • LOG

      public static final org.slf4j.Logger LOG
  • Constructor Details

    • StorageLocationChecker

      public StorageLocationChecker(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.util.Timer timer) throws org.apache.hadoop.util.DiskChecker.DiskErrorException
      Throws:
      org.apache.hadoop.util.DiskChecker.DiskErrorException
  • Method Details

    • check

      public List<StorageLocation> check(org.apache.hadoop.conf.Configuration conf, Collection<StorageLocation> dataDirs) throws InterruptedException, IOException
      Initiate a check on the supplied storage volumes and return a list of healthy volumes. StorageLocations are returned in the same order as the input for compatibility with existing unit tests.
      Parameters:
      conf - HDFS configuration.
      dataDirs - list of volumes to check.
      Returns:
      returns a list of healthy volumes. Returns an empty list if there are no healthy volumes.
      Throws:
      InterruptedException - if the check was interrupted.
      IOException - if the number of failed volumes exceeds the maximum allowed or if there are no good volumes.
    • shutdownAndWait

      public void shutdownAndWait(int gracePeriod, TimeUnit timeUnit)