Class StorageVolumeChecker

java.lang.Object
org.apache.hadoop.ozone.container.common.volume.StorageVolumeChecker

public class StorageVolumeChecker extends Object
A class that encapsulates running disk checks against each volume and allows retrieving a list of failed volumes. The class only detects failed volumes and handling of failed volumes is responsibility of caller.
  • Field Details

    • MAX_VOLUME_FAILURE_TOLERATED_LIMIT

      public static final int MAX_VOLUME_FAILURE_TOLERATED_LIMIT
      See Also:
  • Constructor Details

    • StorageVolumeChecker

      public StorageVolumeChecker(org.apache.hadoop.hdds.conf.ConfigurationSource conf, org.apache.hadoop.util.Timer timer, String threadNamePrefix)
      Parameters:
      conf - Configuration object.
      timer - Timer object used for throttling checks.
  • Method Details

    • start

      public void start()
    • registerVolumeSet

      public void registerVolumeSet(VolumeSet volumeSet)
    • checkAllVolumeSets

      public void checkAllVolumeSets()
    • checkAllVolumes

      public Set<? extends StorageVolume> checkAllVolumes(Collection<? extends StorageVolume> volumes) throws InterruptedException
      Run checks against all volumes.

      This check may be performed at service startup and subsequently at regular intervals to detect and handle failed volumes.

      Parameters:
      volumes - - Set of volumes to be checked. This set must be immutable for the duration of the check else the results will be unexpected.
      Returns:
      set of failed volumes.
      Throws:
      InterruptedException
    • checkVolume

      public boolean checkVolume(StorageVolume volume, StorageVolumeChecker.Callback callback)
      Check a single volume asynchronously, returning a ListenableFuture that can be used to retrieve the final result.

      If the volume cannot be referenced then it is already closed and cannot be checked. No error is propagated to the callback.

      Parameters:
      volume - the volume that is to be checked.
      callback - callback to be invoked when the volume check completes.
      Returns:
      true if the check was scheduled and the callback will be invoked. false otherwise.
    • shutdownAndWait

      public void shutdownAndWait(int gracePeriod, TimeUnit timeUnit)
      Shutdown the checker and its associated ExecutorService.

      See ExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit) for the interpretation of the parameters.

    • getMetrics

      public BackgroundVolumeScannerMetrics getMetrics()