{"record":{"id":"ad9e1e73d21466c2","repo":"apache/hadoop","slug":"incompatible-namespaceids-namenode-namespaceid","errorCode":null,"errorMessage":"Incompatible namespaceIDs:  Namenode namespaceID = {}; {} node namespaceID = {}","messagePattern":"Incompatible namespaceIDs:  Namenode namespaceID = (.+?); (.+?) node namespaceID = (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"critical","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java","lineNumber":6240,"sourceCode":"    FSDirWriteFileOp.persistBlocks(dir, src, pendingFile, logRetryCache);\n  }\n\n  /**\n   * Register a Backup name-node, verifying that it belongs\n   * to the correct namespace, and adding it to the set of\n   * active journals if necessary.\n   * \n   * @param bnReg registration of the new BackupNode\n   * @param nnReg registration of this NameNode\n   * @throws IOException if the namespace IDs do not match\n   */\n  void registerBackupNode(NamenodeRegistration bnReg,\n      NamenodeRegistration nnReg) throws IOException {\n    writeLock(RwLockMode.FS);\n    try {\n      if(getNNStorage().getNamespaceID()\n         != bnReg.getNamespaceID())\n        throw new IOException(\"Incompatible namespaceIDs: \"\n            + \" Namenode namespaceID = \"\n            + getNNStorage().getNamespaceID() + \"; \"\n            + bnReg.getRole() +\n            \" node namespaceID = \" + bnReg.getNamespaceID());\n      if (bnReg.getRole() == NamenodeRole.BACKUP) {\n        getFSImage().getEditLog().registerBackupNode(\n            bnReg, nnReg);\n      }\n    } finally {\n      writeUnlock(RwLockMode.FS, \"registerBackupNode\");\n    }\n  }\n\n  /**\n   * Release (unregister) backup node.\n   * <p>\n   * Find and remove the backup stream corresponding to the node.\n   * @throws IOException","sourceCodeStart":6222,"sourceCodeEnd":6258,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L6222-L6258","documentation":"registerBackupNode rejects a BackupNode whose namespaceID differs from this NameNode's, throwing IOException with both ids. Namespace id is assigned at format time, so a mismatch means the two nodes were initialized against different (or re-formatted) clusters and cannot share journals.","triggerScenarios":"Starting a BackupNode with storage directories formatted against another namespace, or after the NameNode was re-formatted while the BackupNode kept its old state.","commonSituations":"Re-formatting the NameNode without cleaning BackupNode dirs; copying configs across test clusters; reusing data directories from a previous cluster build.","solutions":["Wipe or re-format the BackupNode's name directories so it re-registers and re-downloads the namespace","Verify namespaceID/clusterID/blockPoolId match across nodes (VERSION files, 'hdfs dfsadmin -report')","Never reuse storage directories across cluster lifecycles; keep a provisioning step that formats both together"],"exampleFix":"# before\nhdfs --daemon start backupnode  # VERSION file from an old cluster\n\n# after\nrm -rf /dfs/backupnode/current   # or point to a fresh dir / format it\nhdfs --daemon start backupnode    # re-registers with current namespace","handlingStrategy":"validation","validationCode":"// compare VERSION files before starting the BackupNode\nProperties nnV = readProps(nnDir + \"/current/VERSION\");\nProperties bnV = readProps(bnDir + \"/current/VERSION\");\nif (bnV.isEmpty() || !nnV.getProperty(\"namespaceID\").equals(bnV.getProperty(\"namespaceID\"))) {\n  // wipe bnDir so it re-downloads the namespace\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When re-formatting the NameNode, always clean/re-format BackupNode storage too","Provision NN and BN from the same automation so ids are created together","Compare namespaceID/clusterID in VERSION files as a preflight check"],"tags":["hdfs","namenode","backup-node","namespace-id","cluster-identity"],"backgroundTag":"namespace-id-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}