Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
try { StorageLocation location = StorageLocation.parse(locationString); StorageVolume volume = volumeFactory.createVolume( location.getUri().getPath(), location.getStorageType()); LOG.info("Added Volume : {} to VolumeSet", volume.getStorageDir().getPath()); if (!volume.getStorageDir().mkdirs() && !volume.getStorageDir().exists()) { throw new IOException("Failed to create storage dir " + volume.getStorageDir()); } volumeMap.put(volume.getStorageDir().getPath(), volume); volumeStateMap.get(volume.getStorageType()).add(volume); } catch (IOException e) { StorageVolume volume = volumeFactory.createFailedVolume(locationString); failedVolumeMap.put(locationString, volume); LOG.error("Failed to parse the storage location: " + locationString, e); }
Any IOException thrown from/after volumeFactory.createVolume results in the creation of another, failed volume for the same dir (volumeFactory.createFailedVolume).
Metrics is registered for each HddsVolume in its constructor. The metrics for the original volume should be unregistered, otherwise we get:
MetricsException: Metrics source VolumeInfoMetrics-/data/hdds/... already exists
and datanode fails to start.