{"record":{"id":"fe0cafdac6711dbf","repo":"apache/hadoop","slug":"storage-directory-sd-getroot-getabsolutepath","errorCode":null,"errorMessage":"storage directory \" + sd.getRoot().getAbsolutePath()","messagePattern":"storage directory \" \\+ sd\\.getRoot\\(\\)\\.getAbsolutePath\\(\\)","errorType":"exception","errorClass":"IncorrectVersionException","httpStatus":null,"severity":"critical","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java","lineNumber":691,"sourceCode":"      String sbpid = props.getProperty(\"blockpoolID\");\n      setBlockPoolID(sd.getRoot(), sbpid);\n    }\n    setDeprecatedPropertiesForUpgrade(props);\n  }\n\n  void readProperties(StorageDirectory sd, StartupOption startupOption)\n      throws IOException {\n    Properties props = readPropertiesFile(sd.getVersionFile());\n    if (props == null) {\n      throw new IOException(\n          \"Properties not found  for storage directory \" + sd);\n    }\n    if (HdfsServerConstants.RollingUpgradeStartupOption.ROLLBACK\n        .matches(startupOption)) {\n      int lv = Integer.parseInt(getProperty(props, sd, \"layoutVersion\"));\n      if (lv > getServiceLayoutVersion()) {\n        // we should not use a newer version for rollingUpgrade rollback\n        throw new IncorrectVersionException(getServiceLayoutVersion(), lv,\n            \"storage directory \" + sd.getRoot().getAbsolutePath());\n      }\n      props.setProperty(\"layoutVersion\",\n          Integer.toString(getServiceLayoutVersion()));\n    }\n    setFieldsFromProperties(props, sd);\n  }\n\n  /**\n   * Pull any properties out of the VERSION file that are from older\n   * versions of HDFS and only necessary during upgrade.\n   */\n  private void setDeprecatedPropertiesForUpgrade(Properties props) {\n    deprecatedProperties = new HashMap<>();\n    String md5 = props.getProperty(DEPRECATED_MESSAGE_DIGEST_PROPERTY);\n    if (md5 != null) {\n      deprecatedProperties.put(DEPRECATED_MESSAGE_DIGEST_PROPERTY, md5);\n    }","sourceCodeStart":673,"sourceCodeEnd":709,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L673-L709","documentation":"During rolling-upgrade ROLLBACK startup, readProperties compares the layoutVersion in the directory's VERSION with the running software's service layout version; if storage was written by a newer release (lv > getServiceLayoutVersion()), IncorrectVersionException is thrown because old binaries cannot undo the newer layout changes. Downgrade via 'rollingupgrade rollback' is therefore not supported.","triggerScenarios":"Running 'hdfs namenode -rollingupgrade rollback' with older-version binaries after the cluster already persisted a newer layoutVersion in VERSION - i.e. attempting a downgrade rollback after the upgrade was finalized or progressed too far.","commonSituations":"Aborting a failed rolling upgrade after NNs already upgraded; ops skipping the documented rollback-before-finalize order; PATH still pointing at old packages (rpm/alternatives leftovers) so the 'new' node actually runs old code.","solutions":["Restart with the same or newer Hadoop version that wrote the storage, and finish the rollback from there.","If a real downgrade is required, use the supported downgrade path of the newer release ('rollingupgrade downgrade' with the new binaries), not old-binary rollback.","Verify the running binary with 'hdfs version' and compare it against the layoutVersion line in the dir's VERSION before choosing."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before rolling-upgrade rollback, compare on-disk layout with the running binary\nint diskLv = Integer.parseInt(Files.readAllLines(versionFile).stream()\n    .filter(l -> l.startsWith(\"layoutVersion=\")).findFirst().orElseThrow()\n    .split(\"=\")[1]);\nif (diskLv > HdfsServerConstants.NAMENODE_LAYOUT_VERSION) {\n  throw new UnsupportedOperationException(\n      \"Storage layout \" + diskLv + \" is newer than this binary (\" + HdfsServerConstants.NAMENODE_LAYOUT_VERSION\n      + \") - rollback with the newer binaries or use rollingupgrade downgrade\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the exact upgraded-version binaries available until 'rollingupgrade finalize' completes.","Pin Hadoop versions in packages/alternatives so PATH cannot silently select old jars.","Dry-run rollback order in staging: rollback must happen before finalize."],"tags":["hdfs","upgrade","rollback","layout-version"],"backgroundTag":"layout-version-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}