apache/hadoop · error · SnapshotException

Failed to removeSnapshot {} from {}: Unexpected prior (={})

Error message

Failed to removeSnapshot {} from {}: Unexpected prior (={}) when dfs.namenode.snapshot.deletion.ordered is {}

What it means

Error "Failed to removeSnapshot {} from {}: Unexpected prior (={}) when dfs.namenode.snapshot.deletion.ordered is {}" thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/SnapshotManager.java:350

    final Snapshot.Root snapshotRoot = dir.getDirectorySnapshottableFeature()
        .getSnapshotByName(dir, snapshotName)
        .getRoot();

    if (!snapshotRoot.isMarkedAsDeleted()) {
      throw new SnapshotException("Failed to gcDeletedSnapshot "
          + snapshotName + " from " + dir.getFullPathName()
          + ": snapshot is not marked as deleted");
    }
  }

  void assertPrior(INodeDirectory dir, String snapshotName, int prior)
      throws SnapshotException {
    if (!isSnapshotDeletionOrdered()) {
      return;
    }
    // prior must not exist
    if (prior != Snapshot.NO_SNAPSHOT_ID) {
      throw new SnapshotException("Failed to removeSnapshot "
          + snapshotName + " from " + dir.getFullPathName()
          + ": Unexpected prior (=" + prior + ") when "
          + DFS_NAMENODE_SNAPSHOT_DELETION_ORDERED
          + " is " + isSnapshotDeletionOrdered());
    }
  }

  void assertFirstSnapshot(INodeDirectory dir,
      DirectorySnapshottableFeature snapshottable, Snapshot snapshot)
      throws SnapshotException {
    final INodeDirectoryAttributes first
        = snapshottable.getDiffs().getFirstSnapshotINode();
    if (snapshot.getRoot() != first) {
      throw new SnapshotException("Failed to delete snapshot " + snapshot
          + " from " + dir.getFullPathName() + " since " + snapshot
          + " is not the first snapshot (=" + first + ") and "
          + DFS_NAMENODE_SNAPSHOT_DELETION_ORDERED
          + " is " + isSnapshotDeletionOrdered());

View on GitHub (pinned to 2add963021)

Solutions

  1. Check the value of dfs.namenode.snapshot.deletion.ordered and delete snapshots in order, or set it to false for out-of-order deletion.

When it happens

Trigger: Snapshot removal encounters an unexpected prior snapshot while ordered deletion is enforced.

Common situations: Deleting snapshots out of order with dfs.namenode.snapshot.deletion.ordered=true.


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