apache/hadoop · error · InconsistentFSStateException

Unexpected blockpoolID {}. Expected {}

Error message

Unexpected blockpoolID {}. Expected {}

What it means

The blockpoolID in the VERSION file disagrees with the block pool already loaded/expected: the storage directory contents belong to a different block pool than the one being loaded. Thrown as InconsistentFSStateException with expected vs actual IDs.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceStorage.java:334

  @Override
  protected void setPropertiesFromFields(Properties props, StorageDirectory sd)
      throws IOException {
    props.setProperty("layoutVersion", String.valueOf(layoutVersion));
    props.setProperty("namespaceID", String.valueOf(namespaceID));
    props.setProperty("blockpoolID", blockpoolID);
    props.setProperty("cTime", String.valueOf(cTime));
  }

  /** 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_FILE_VERSION + " is invalid.");
    }
    
    if (!blockpoolID.equals("") && !blockpoolID.equals(bpid)) {
      throw new InconsistentFSStateException(storage,
          "Unexpected blockpoolID " + bpid + ". Expected " + blockpoolID);
    }
    blockpoolID = bpid;
  }
  
  @Override
  protected void setFieldsFromProperties(Properties props, StorageDirectory sd)
      throws IOException {
    setLayoutVersion(props, sd);
    setNamespaceID(props, sd);
    setcTime(props, sd);
    
    String sbpid = props.getProperty("blockpoolID");
    setBlockPoolID(sd.getRoot(), sbpid);
  }

  /**
   * Analyze whether a transition of the BP state is required and

View on GitHub (pinned to 2add963021)

Solutions

  1. Move the directory back under a path named for its real bpid (or fix the VERSION blockpoolID to match the directory's pool)
  2. If the blocks belong to an old cluster you no longer run, delete the BP dir
  3. Never clone block pool directories between clusters — re-replicate instead
Defensive patterns

Strategy: validation

Validate before calling

String dirBpid = bpDir.getName();
String fileBpid = props.getProperty("blockpoolID");
if (!dirBpid.equals(fileBpid)) {
  throw new IOException("BP dir " + dirBpid + " contains storage for " + fileBpid);
}

Prevention

When it happens

Trigger: A BP directory copied or renamed from another cluster or another block pool; VERSION edited to the wrong bpid; storage from two clusters mixed on one DN.

Common situations: Migrating disks between test clusters by file copy; restoring BP dirs into the wrong cluster; NN re-formatted generating a new bpid while old dirs linger.

Related errors


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