{"record":{"id":"4aa0e79753846d81","repo":"apache/hadoop","slug":"diff-is-negative-please-check","errorCode":null,"errorMessage":"diff={} is negative. Please check {}","messagePattern":"diff=(.+?) is negative\\. Please check (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterFederationRename.java","lineNumber":283,"sourceCode":"  static void checkConfiguration(Configuration conf) throws IOException {\n    int map = conf.getInt(DFS_ROUTER_FEDERATION_RENAME_MAP, -1);\n    int bandwidth = conf.getInt(DFS_ROUTER_FEDERATION_RENAME_BANDWIDTH, -1);\n    long delay = conf.getLong(DFS_ROUTER_FEDERATION_RENAME_DELAY,\n        DFS_ROUTER_FEDERATION_RENAME_DELAY_DEFAULT);\n    int diff = conf.getInt(DFS_ROUTER_FEDERATION_RENAME_DIFF,\n        DFS_ROUTER_FEDERATION_RENAME_DIFF_DEFAULT);\n    if (map < 0) {\n      throw new IOException(\"map=\" + map + \" is negative. Please check \"\n          + DFS_ROUTER_FEDERATION_RENAME_MAP);\n    } else if (bandwidth < 0) {\n      throw new IOException(\n          \"bandwidth=\" + bandwidth + \" is negative. Please check \"\n              + DFS_ROUTER_FEDERATION_RENAME_BANDWIDTH);\n    } else if (delay < 0) {\n      throw new IOException(\"delay=\" + delay + \" is negative. Please check \"\n          + DFS_ROUTER_FEDERATION_RENAME_DELAY);\n    } else if (diff < 0) {\n      throw new IOException(\"diff=\" + diff + \" is negative. Please check \"\n          + DFS_ROUTER_FEDERATION_RENAME_DIFF);\n    }\n  }\n}\n","sourceCodeStart":265,"sourceCodeEnd":288,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterFederationRename.java#L265-L288","documentation":"checkConfiguration validates the fed-rename diff threshold read from dfs.federation.router.federation.rename.diff (default 0, meaning the check passes unless explicitly set negative). 'diff' bounds the allowed difference when the rename procedure compares src/dst states before finalizing; a negative value is rejected before a job is submitted.","triggerScenarios":"dfs.federation.router.federation.rename.diff is explicitly set to a negative integer in the router configuration and a cross-namespace rename runs checkConfiguration.","commonSituations":"Placeholder -1 values from templates; mistaken belief that -1 disables the diff check (it does not - 0 is the neutral value); hand-edited configs where a stray minus sign slips in.","solutions":["Set dfs.federation.router.federation.rename.diff to a non-negative integer (default 0) or drop the key from the config","Sanity-check all four fed-rename numeric keys (map, bandwidth, delay, diff) with a config linter before deploying","Restart the router after the fix"],"exampleFix":"# before\n<property><name>dfs.federation.router.federation.rename.diff</name><value>-1</value></property>\n# after\n<property><name>dfs.federation.router.federation.rename.diff</name><value>0</value></property>","handlingStrategy":"validation","validationCode":"int diff = conf.getInt(\"dfs.federation.router.federation.rename.diff\", 0);\nif (diff < 0) {\n  throw new IllegalStateException(\n      \"dfs.federation.router.federation.rename.diff must be non-negative (0 is the neutral default)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  routerFedRename.routerFedRename(src, dst, srcLocs, dstLocs);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"dfs.federation.router.federation.rename.diff\")) {\n    // fix the negative diff value named in the message, restart router\n  }\n  throw e;\n}","preventionTips":["Use 0 (the default) to disable the diff threshold, never -1","Keep fed-rename config in a single include file so keys are changed atomically","Run a config sanity check job on routers before enabling fed rename in production"],"tags":["hdfs","router","federation","rename","configuration","diff"],"backgroundTag":"invalid-configuration-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}