apache/hadoop · error · IllegalArgumentException

Quota for storage type '${type}' is not supported

Error message

Quota for storage type '${type}' is not supported

What it means

WebHdfsFileSystem.setQuotaByStorageType rejects storage types that cannot carry a type quota, checked via StorageType.supportTypeQuota(), which returns !isTransient. In the current enum only RAM_DISK is transient, so RAM_DISK is the type that triggers this IllegalArgumentException. Per-type quotas are meaningless for transient storage because RAM_DISK blocks are lazily persisted to DISK and evicted.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java:2083

    statistics.incrementWriteOps(1);
    storageStatistics.incrementOpCounter(OpType.SET_QUOTA_USAGE);

    final HttpOpParam.Op op = PutOpParam.Op.SETQUOTA;
    new FsPathRunner(op, p, new NameSpaceQuotaParam(namespaceQuota),
        new StorageSpaceQuotaParam(storagespaceQuota)).run();
  }

  @Override
  public void setQuotaByStorageType(Path path, StorageType type, long quota)
      throws IOException {
    if (quota <= 0 && quota != HdfsConstants.QUOTA_RESET) {
      throw new IllegalArgumentException("Invalid values for quota :" + quota);
    }
    if (type == null) {
      throw new IllegalArgumentException("Invalid storage type (null)");
    }
    if (!type.supportTypeQuota()) {
      throw new IllegalArgumentException(
          "Quota for storage type '" + type.toString() + "' is not supported");
    }

    statistics.incrementWriteOps(1);
    storageStatistics.incrementOpCounter(OpType.SET_QUOTA_BYTSTORAGEYPE);

    final HttpOpParam.Op op = PutOpParam.Op.SETQUOTABYSTORAGETYPE;
    new FsPathRunner(op, path, new StorageTypeParam(type.name()),
        new StorageSpaceQuotaParam(quota)).run();
  }

  @Override
  public MD5MD5CRC32FileChecksum getFileChecksum(final Path p
  ) throws IOException {
    statistics.incrementReadOps(1);
    storageStatistics.incrementOpCounter(OpType.GET_FILE_CHECKSUM);

    final HttpOpParam.Op op = GetOpParam.Op.GETFILECHECKSUM;

View on GitHub (pinned to 2add963021)

Solutions

  1. Skip transient types (RAM_DISK) when applying quotas programmatically: filter with type.supportTypeQuota()
  2. Use DISK/SSD/ARCHIVE (non-transient types) for type quotas
  3. To limit memory usage of LAZY_PERSIST writes, use the storage policy mechanism and datanode memory limits instead of quotas

Example fix

// before
for (StorageType t : StorageType.values()) {
  fs.setQuotaByStorageType(path, t, quota); // throws on RAM_DISK
}
// after
for (StorageType t : StorageType.values()) {
  if (t.supportTypeQuota()) {
    fs.setQuotaByStorageType(path, t, quota);
  }
}
Defensive patterns

Strategy: type-guard

Validate before calling

for (StorageType t : StorageType.values()) {
  if (t.supportTypeQuota()) {   // false only for transient types (RAM_DISK)
    fs.setQuotaByStorageType(path, t, quota);
  }
}

Type guard

static boolean supportsTypeQuota(StorageType t) {
  return t != null && t.supportTypeQuota(); // excludes RAM_DISK (transient)
}

Prevention

When it happens

Trigger: Calling fs.setQuotaByStorageType(path, StorageType.RAM_DISK, quota) — RAM_DISK is transient (StorageType.java:37, supportTypeQuota() at :66-68) so the check fails; any future transient type added to the enum would also fail.

Common situations: Generic 'apply quota to every storage type' loops that iterate StorageType.values(); config-driven quota tooling that receives 'RAM_DISK' as a target; misunderstanding that memory storage is capped differently (via LAZY_PERSIST policy and memory limits, not type quotas).

Related errors


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