{"record":{"id":"695e52d39b29ee78","repo":"apache/hadoop","slug":"capacity-ratio-config-is-not-with-correct-format","errorCode":null,"errorMessage":"Capacity ratio config is not with correct format: {}","messagePattern":"Capacity ratio config is not with correct format: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/StorageLocation.java","lineNumber":187,"sourceCode":"    Map<URI, Double> result = new HashMap<>();\n    capacityRatioConf = capacityRatioConf.replaceAll(\"\\\\s\", \"\");\n    if (capacityRatioConf.isEmpty()) {\n      return result;\n    }\n    String[] capacityRatios = capacityRatioConf.split(\",\");\n    for (String ratio : capacityRatios) {\n      Matcher matcher = CAPACITY_RATIO_REGEX.matcher(ratio);\n      if (matcher.matches()) {\n        String capacityString = matcher.group(1).trim();\n        String location = matcher.group(2).trim();\n        double capacityRatio = Double.parseDouble(capacityString);\n        if (capacityRatio > 1 || capacityRatio < 0) {\n          throw new IllegalArgumentException(\"Capacity ratio\" + capacityRatio\n              + \" is not between 0 to 1: \" + ratio);\n        }\n        result.put(new Path(location).toUri(), capacityRatio);\n      } else {\n        throw new IllegalArgumentException(\n            \"Capacity ratio config is not with correct format: \"\n                + capacityRatioConf\n        );\n      }\n    }\n    return result;\n  }\n\n  @Override\n  public String toString() {\n    return \"[\" + storageType + \"]\" + baseURI.normalize();\n  }\n\n  @Override\n  public boolean equals(Object obj) {\n    if (!(obj instanceof StorageLocation)) {\n      return false;\n    }","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/StorageLocation.java#L169-L205","documentation":"Each comma-separated entry of dfs.datanode.same.disk.tiering.capacity.ratio.percentage must match the regex ^\\[([0-9.]*)\\](.+)$ - a bracketed number followed by a volume path. Any entry that does not match (missing brackets, missing path, stray characters) makes StorageLocation.parseCapacityRatio() throw IllegalArgumentException with the whole config string.","triggerScenarios":"Setting dfs.datanode.same.disk.tiering.capacity.ratio.percentage to e.g. '0.5:/disk1' (colon instead of [num]/path), 'disk1' (no ratio), '[0.5]' (no path), or leaving a trailing comma producing an empty entry; whitespace is stripped before matching, but structure must be exact.","commonSituations":"First-time same-disk-tiering configuration using URI-ish 'key=value' habits instead of the [ratio]/path syntax; copy-paste from docs that lost the brackets; trailing separators after edits.","solutions":["Format every entry as [fraction]/absolute/path - e.g. [0.3]/disk1/archive,[0.2]/disk2/archive","Remove trailing/empty comma-separated entries","Validate locally before deploy: every token must match Pattern \\\\[(\\\\d+\\\\.\\\\d*)\\\\](.+)"],"exampleFix":"# before (hdfs-site.xml)\n<property>\n  <name>dfs.datanode.same.disk.tiering.capacity.ratio.percentage</name>\n  <value>0.3:/disk1/archive,0.2:/disk2/archive</value>\n</property>\n\n# after\n<property>\n  <name>dfs.datanode.same.disk.tiering.capacity.ratio.percentage</name>\n  <value>[0.3]/disk1/archive,[0.2]/disk2/archive</value>\n</property>","handlingStrategy":"validation","validationCode":"static boolean isValidCapacityRatioEntry(String entry) {\n  return entry.matches(\"^\\\\[[0-9.]+\\\\]/.+\"); // ratio in brackets + absolute-ish path\n}\n// validate every comma token of the config before DN startup","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Memorize the shape: [fraction]/path - brackets mandatory, path mandatory, no '=' or ':'","Keep one canonical example in the cluster's config repo and diff against it"],"tags":["hdfs","datanode","storage","config","capacity","tiering","illegal-argument"],"backgroundTag":"config-format-invalid","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}