Class StorageVolumeChecker
java.lang.Object
org.apache.hadoop.ozone.container.common.volume.StorageVolumeChecker
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA callback interface that is supplied the result of running an async disk check on multiple volumes. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStorageVolumeChecker(org.apache.hadoop.hdds.conf.ConfigurationSource conf, org.apache.hadoop.util.Timer timer, String threadNamePrefix) -
Method Summary
Modifier and TypeMethodDescriptionSet<? extends StorageVolume> checkAllVolumes(Collection<? extends StorageVolume> volumes) Run checks against all volumes.voidbooleancheckVolume(StorageVolume volume, StorageVolumeChecker.Callback callback) Check a single volume asynchronously, returning aListenableFuturethat can be used to retrieve the final result.voidregisterVolumeSet(VolumeSet volumeSet) voidshutdownAndWait(int gracePeriod, TimeUnit timeUnit) Shutdown the checker and its associated ExecutorService.voidstart()
-
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-Timerobject used for throttling checks.
-
-
Method Details
-
start
public void start() -
registerVolumeSet
-
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
Check a single volume asynchronously, returning aListenableFuturethat 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
Shutdown the checker and its associated ExecutorService.See
ExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit)for the interpretation of the parameters. -
getMetrics
-