You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Attila Doroszlai (Jira)" <ji...@apache.org> on 2019/12/09 11:43:00 UTC

[jira] [Created] (HDDS-2694) HddsVolume#readVersionFile fails when reading older versions

Attila Doroszlai created HDDS-2694:
--------------------------------------

             Summary: HddsVolume#readVersionFile fails when reading older versions
                 Key: HDDS-2694
                 URL: https://issues.apache.org/jira/browse/HDDS-2694
             Project: Hadoop Distributed Data Store
          Issue Type: Bug
          Components: Ozone Datanode
            Reporter: Attila Doroszlai


{{HddsVolume#layoutVersion}} is a version number, supposed to be used for handling upgrades from older versions.  Currently only one version is defined.  But should a new version be introduced, HddsVolume would fail to read older version file.  This is caused by a check in {{HddsVolumeUtil}} that only considers the latest version as valid:

{code:title=https://github.com/apache/hadoop-ozone/blob/1d56bc244995e857b842f62d3d1e544ee100bbc1/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/HddsVolumeUtil.java#L137-L153}
  /**
   * Returns layOutVersion if it is valid. Throws an exception otherwise.
   */
  @VisibleForTesting
  public static int getLayOutVersion(Properties props, File versionFile) throws
      InconsistentStorageStateException {
    String lvStr = getProperty(props, OzoneConsts.LAYOUTVERSION, versionFile);

    int lv = Integer.parseInt(lvStr);
    if(DataNodeLayoutVersion.getLatestVersion().getVersion() != lv) {
      throw new InconsistentStorageStateException("Invalid layOutVersion. " +
          "Version file has layOutVersion as " + lv + " and latest Datanode " +
          "layOutVersion is " +
          DataNodeLayoutVersion.getLatestVersion().getVersion());
    }
    return lv;
  }
{code}

I think this should check whether the version number identifies a known {{DataNodeLayoutVersion}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org