apache/hadoop · critical · InconsistentFSStateException

file VERSION has no block pool Id.

Error message

file VERSION has no block pool Id.

What it means

setBlockPoolID(File, bpid) validates the blockpoolID property read from a directory's VERSION under a federation-capable layout version: null or empty raises InconsistentFSStateException 'file VERSION has no block pool Id.' The block pool ID is namespace-wide under federation, so its absence means the directory predates federation or its VERSION was mangled.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java:1054

    } catch (UnknownHostException e) {
      LOG.warn("Could not find ip address of \"default\" inteface.");
      throw e;
    }
    
    int rand = DFSUtil.getSecureRandom().nextInt(Integer.MAX_VALUE);
    return "BP-" + rand + "-"+ ip + "-" + Time.now();
  }

  /** Validate and set block pool ID. */
  public void setBlockPoolID(String bpid) {
    blockpoolID = bpid;
  }

  /** Validate and set block pool ID. */
  private void setBlockPoolID(File storage, String bpid)
      throws InconsistentFSStateException {
    if (bpid == null || bpid.equals("")) {
      throw new InconsistentFSStateException(storage, "file "
          + Storage.STORAGE_FILE_VERSION + " has no block pool Id.");
    }
    
    if (!blockpoolID.equals("") && !blockpoolID.equals(bpid)) {
      throw new InconsistentFSStateException(storage,
          "Unexepcted blockpoolID " + bpid + " . Expected " + blockpoolID);
    }
    setBlockPoolID(bpid);
  }
  
  public String getBlockPoolID() {
    return blockpoolID;
  }

  /**
   * Iterate over all current storage directories, inspecting them
   * with the given inspector.
   */

View on GitHub (pinned to 2add963021)

Solutions

  1. Restore or insert the cluster's real blockpoolID (format BP-<rand>-<ip>-<ts>) into the affected VERSION - it must equal the BP id in all other dirs of the same nameservice.
  2. If every dir lacks it and this is a pre-federation upgrade, follow the federation upgrade path for that release instead of hand-patching.
  3. Back up VERSION before editing; a wrong BP id produces the sibling 'Unexepcted blockpoolID' error next.
Defensive patterns

Strategy: validation

Validate before calling

// Assert every VERSION carries a blockpoolID before NN start
for (String loc : conf.getTrimmedStrings("dfs.namenode.name.dir")) {
  Map<String, String> props = parseVersion(Paths.get(stripScheme(loc), "current", "VERSION"));
  String bpid = props.get("blockpoolID");
  if (bpid == null || bpid.trim().isEmpty()) {
    throw new IllegalStateException("VERSION lacks blockpoolID (pre-federation or damaged): " + loc);
  }
}

Prevention

When it happens

Trigger: Reading a storage dir written by a pre-federation Hadoop release, or a VERSION whose blockpoolID line was removed or lost to a partial write (crash during writeProperties) or manual editing.

Common situations: Very old clusters moved to federation-capable releases without the documented upgrade procedure; hand-restored VERSION files missing lines; scripts that rewrite VERSION dropping keys they do not know.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/8fddf9e7d0c4f81d. Report an issue: GitHub.