apache/hadoop · warning · UnsupportedOperationException

Refresh not supported by " + getClass()

Error message

Refresh not supported by " + getClass()

What it means

BlockAliasMap.refresh() is the extension point for implementations that can reload their backing state without restarting. TextFileRegionAliasMap does not support it and always throws UnsupportedOperationException — its TextReader opens the text file on demand, so there is no cached state to refresh.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/blockaliasmap/impl/TextFileRegionAliasMap.java:469

      out.append(Long.toString(psl.getLength())).append(delim);
      out.append(Long.toString(block.getGenerationStamp()));
      if (psl.getNonce().length > 0) {
        out.append(delim)
            .append(Base64.getEncoder().encodeToString(psl.getNonce()));
      }
      out.append("\n");
    }

    @Override
    public void close() throws IOException {
      out.close();
    }

  }

  @Override
  public void refresh() throws IOException {
    throw new UnsupportedOperationException(
        "Refresh not supported by " + getClass());
  }

  @Override
  public void close() throws IOException {
    // nothing to do;
  }

  @VisibleForTesting
  public static String blockPoolIDFromFileName(Path file) {
    if (file == null) {
      return "";
    }
    String fileName = file.getName();
    return fileName.substring("blocks_".length()).split("\\.")[0];
  }

  @VisibleForTesting

View on GitHub (pinned to 2add963021)

Solutions

  1. Drop or skip the refresh() call when the implementation is the text alias map
  2. To pick up a regenerated file, simply obtain a new Reader via getReader() — each reader re-opens the file
  3. If runtime refresh is a hard requirement, use an implementation that supports it (e.g., InMemoryLevelDBAliasMap) instead of text

Example fix

// before
aliasMap.refresh(); // throws for TextFileRegionAliasMap

// after
if (aliasMap instanceof TextFileRegionAliasMap) {
  reader = aliasMap.getReader(null, bpid); // fresh reader re-opens the file
} else {
  aliasMap.refresh();
}
Defensive patterns

Strategy: type-guard

Type guard

static boolean supportsRefresh(BlockAliasMap<?> map) {
  return !(map instanceof TextFileRegionAliasMap);
}

Prevention

When it happens

Trigger: Invoking refresh() on a TextFileRegionAliasMap instance, typically through generic management/tooling code that calls refresh on whatever alias map dfs.provided.aliasmap.class selected.

Common situations: Switching the alias map implementation to text while retaining a refresh call; ops tooling that 'refreshes all alias maps' after regenerating the text file.

Related errors


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