/** * Dynamically remove volume in the list. * @param storageLocation {@link StorageLocation} of the volume to be removed. * @param clearFailure set true to remove failure info for this volume. */ void removeVolume(StorageLocation storageLocation, boolean clearFailure) { for (FsVolumeImpl fsVolume : volumes) { StorageLocation baseLocation = fsVolume.getStorageLocation(); if (baseLocation.equals(storageLocation)) { removeVolume(fsVolume); } } if (clearFailure) { removeVolumeFailureInfo(storageLocation); } }
/** * Dynamically add new volumes to the existing volumes that this DN manages. * * @param ref a reference to the new FsVolumeImpl instance. */ void addVolume(FsVolumeReference ref) { FsVolumeImpl volume = (FsVolumeImpl) ref.getVolume(); volumes.add(volume); if (blockScanner != null) { blockScanner.addVolumeScanner(ref); } else { // If the volume is not put into a volume scanner, it does not need to // hold the reference. IOUtils.cleanup(null, ref); } // If the volume is used to replace a failed volume, it needs to reset the // volume failure info for this volume. removeVolumeFailureInfo(volume.getStorageLocation()); FsDatasetImpl.LOG.info("Added new volume: " + volume.getStorageID()); }
volumes.removeVolumeFailureInfo(storageLocToRemove);
/** * Dynamically remove volume in the list. * @param volume the volume to be removed. * @param clearFailure set true to remove failure info for this volume. */ void removeVolume(File volume, boolean clearFailure) { // Make a copy of volumes to remove one volume. final FsVolumeImpl[] curVolumes = volumes.get(); final List<FsVolumeImpl> volumeList = Lists.newArrayList(curVolumes); for (Iterator<FsVolumeImpl> it = volumeList.iterator(); it.hasNext(); ) { FsVolumeImpl fsVolume = it.next(); String basePath, targetPath; basePath = new File(fsVolume.getBasePath()).getAbsolutePath(); targetPath = volume.getAbsolutePath(); if (basePath.equals(targetPath)) { // Make sure the removed volume is the one in the curVolumes. removeVolume(fsVolume); } } if (clearFailure) { removeVolumeFailureInfo(volume); } }
/** * Dynamically remove volume in the list. * @param volume the volume to be removed. * @param clearFailure set true to remove failure info for this volume. */ void removeVolume(File volume, boolean clearFailure) { // Make a copy of volumes to remove one volume. final FsVolumeImpl[] curVolumes = volumes.get(); final List<FsVolumeImpl> volumeList = Lists.newArrayList(curVolumes); for (Iterator<FsVolumeImpl> it = volumeList.iterator(); it.hasNext(); ) { FsVolumeImpl fsVolume = it.next(); String basePath, targetPath; basePath = new File(fsVolume.getBasePath()).getAbsolutePath(); targetPath = volume.getAbsolutePath(); if (basePath.equals(targetPath)) { // Make sure the removed volume is the one in the curVolumes. removeVolume(fsVolume); } } if (clearFailure) { removeVolumeFailureInfo(volume); } }
removeVolumeFailureInfo(new File(ref.getVolume().getBasePath())); FsDatasetImpl.LOG.info("Added new volume: " + ref.getVolume().getStorageID());
removeVolumeFailureInfo(new File(ref.getVolume().getBasePath())); FsDatasetImpl.LOG.info("Added new volume: " + ref.getVolume().getStorageID());