{"record":{"id":"ec78fc4d0196bfa7","repo":"apache/hadoop","slug":"incompatible-blockpoolids-in-namenode-blockpoo","errorCode":null,"errorMessage":"Incompatible blockpoolIDs in {}: namenode blockpoolID = {}; datanode blockpoolID = {}","messagePattern":"Incompatible blockpoolIDs in (.+?): namenode blockpoolID = (.+?); datanode blockpoolID = (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"critical","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceStorage.java","lineNumber":399,"sourceCode":"        !sd.getPreviousDir().exists()) {\n      // Restore all the files in the trash. The restored files are retained\n      // during rolling upgrade rollback. They are deleted during rolling\n      // upgrade downgrade.\n      int restored = restoreBlockFilesFromTrash(getTrashRootDir(sd));\n      LOG.info(\"Restored {} block files from trash.\", restored);\n    }\n    readProperties(sd);\n    checkVersionUpgradable(this.layoutVersion);\n    assert this.layoutVersion >= DataNodeLayoutVersion.getCurrentLayoutVersion()\n       : \"Future version is not allowed\";\n    if (getNamespaceID() != nsInfo.getNamespaceID()) {\n      throw new IOException(\"Incompatible namespaceIDs in \"\n          + sd.getRoot().getCanonicalPath() + \": namenode namespaceID = \"\n          + nsInfo.getNamespaceID() + \"; datanode namespaceID = \"\n          + getNamespaceID());\n    }\n    if (!blockpoolID.equals(nsInfo.getBlockPoolID())) {\n      throw new IOException(\"Incompatible blockpoolIDs in \"\n          + sd.getRoot().getCanonicalPath() + \": namenode blockpoolID = \"\n          + nsInfo.getBlockPoolID() + \"; datanode blockpoolID = \"\n          + blockpoolID);\n    }\n    if (this.layoutVersion == DataNodeLayoutVersion.getCurrentLayoutVersion()\n        && this.cTime == nsInfo.getCTime()) {\n      return false; // regular startup\n    }\n    if (this.layoutVersion > DataNodeLayoutVersion.getCurrentLayoutVersion()) {\n      int restored = restoreBlockFilesFromTrash(getTrashRootDir(sd));\n      LOG.info(\"Restored {} block files from trash \" +\n          \"before the layout upgrade. These blocks will be moved to \" +\n          \"the previous directory during the upgrade\", restored);\n    }\n    if (this.layoutVersion > DataNodeLayoutVersion.getCurrentLayoutVersion()\n        || this.cTime < nsInfo.getCTime()) {\n      doUpgrade(sd, nsInfo, callables, conf); // upgrade\n      return true;","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceStorage.java#L381-L417","documentation":"Companion check to the namespaceID guard: the blockpoolID persisted in the DN's block pool storage differs from the one the NameNode announces during registration. The DN refuses to attach foreign block pool data to this namespace.","triggerScenarios":"NN re-formatted (new bpid) while DN retained the old BP dir; DN storage copied from another cluster; registration against the wrong nameservice.","commonSituations":"Same class as namespaceID mismatch: reformat without DN cleanup, cross-cluster disk reuse, federation misrouting.","solutions":["Delete the DN's stale BP directories and restart so it formats for the new bpid","Point the DN at the namespace whose bpid matches its storage, if the data is actually wanted there","Recreate/re-replicate the data if the old namespace is gone"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (IOException e) {\n  if (e.getMessage().contains(\"Incompatible blockpoolIDs\")) {\n    haltForOperator(\"stale BP storage vs current namespace: wipe or repoint\");\n  }\n}","preventionTips":["After any NN format, remove old BP dirs on DNs instead of expecting them to attach","Do not mix storage from different namespaces on one DataNode"],"tags":["hdfs","datanode","storage","blockpoolid","identity-mismatch"],"backgroundTag":"cluster-identity-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}