[ 
https://issues.apache.org/jira/browse/HDDS-8914?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Attila Doroszlai updated HDDS-8914:
-----------------------------------
    Description: 
{code:title=https://github.com/apache/ozone/blob/d66d15fbea56b1e1d3c9dd5c2c55707bb34dd24d/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/MutableVolumeSet.java#L169-L190}
      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);
      }
{code}

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:

{code}
MetricsException: Metrics source VolumeInfoMetrics-/data/hdds/... already exists
{code}

and datanode fails to start.

  was:
{code:title=https://github.com/apache/ozone/blob/d66d15fbea56b1e1d3c9dd5c2c55707bb34dd24d/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/MutableVolumeSet.java#L169-L190}
      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);
      }
{code}

Any {{IOException}} thrown 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:

{code}
MetricsException: Metrics source VolumeInfoMetrics-/data/hdds/... already exists
{code}

and datanode fails to start.


> Datanode may fail to start due to duplicate VolumeInfoMetrics
> -------------------------------------------------------------
>
>                 Key: HDDS-8914
>                 URL: https://issues.apache.org/jira/browse/HDDS-8914
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: Ozone Datanode
>            Reporter: Attila Doroszlai
>            Assignee: Attila Doroszlai
>            Priority: Major
>
> {code:title=https://github.com/apache/ozone/blob/d66d15fbea56b1e1d3c9dd5c2c55707bb34dd24d/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/MutableVolumeSet.java#L169-L190}
>       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);
>       }
> {code}
> 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:
> {code}
> MetricsException: Metrics source VolumeInfoMetrics-/data/hdds/... already 
> exists
> {code}
> and datanode fails to start.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to