apache/hadoop · error · IOException

No edits file for range {}-{}

Error message

No edits file for range {}-{}

What it means

JNStorage.findFinalizedEditsFile builds the expected finalized edits file name (edits_[startTxId]-[endTxId]) in the JournalNode's current dir and throws this IOException when that exact file does not exist. It is the JN-side rejection for a client requesting a finalized segment range the node does not hold.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java:98

    return fjm;
  }

  @Override
  public boolean isPreUpgradableLayout(StorageDirectory sd)
      throws IOException {
    return false;
  }

  /**
   * Find an edits file spanning the given transaction ID range.
   * If no such file exists, an exception is thrown.
   */
  File findFinalizedEditsFile(long startTxId, long endTxId)
      throws IOException {
    File ret = new File(sd.getCurrentDir(),
        NNStorage.getFinalizedEditsFileName(startTxId, endTxId));
    if (!ret.exists()) {
      throw new IOException(
          "No edits file for range " + startTxId + "-" + endTxId);
    }
    return ret;
  }

  /**
   * @return the path for an in-progress edits file starting at the given
   * transaction ID. This does not verify existence of the file. 
   */
  File getInProgressEditLog(long startTxId) {
    return new File(sd.getCurrentDir(),
        NNStorage.getInProgressEditsFileName(startTxId));
  }
  
  /**
   * @param segmentTxId the first txid of the segment
   * @param epoch the epoch number of the writer which is coordinating
   * recovery

View on GitHub (pinned to 2add963021)

Solutions

  1. List the JN's current dir (dfs.journalnode.edits.dir/<jid>/current/) and confirm which edits_start-end files exist; compare against a healthy JN.
  2. If this JN is missing segments, copy them from a healthy JN's dir (JN stopped) or ensure JournalNodeSyncer (dfs.journalnode.sync enabled) catches it up.
  3. Verify the requester is asking for a range that is actually finalized on the quorum (check NN logs / other JNs) — a wrong txid range in the URL or manifest produces the same error.
  4. If files were deleted accidentally, restore from backup or resync the JN entirely from a peer.
Defensive patterns

Strategy: validation

Validate before calling

// Before asking for a finalized range, ask the JN what it actually holds
RemoteEditLogManifest manifest =
    qjm.getEditLogManifest(startTxId); // per-JN via QJournalProtocol
boolean holds = manifest.getEditLogs().stream()
    .anyMatch(l -> l.getStartTxId() == startTxId && l.getEndTxId() == endTxId);
if (!holds) {
  // ask a different JN or wait for this one to sync, instead of erroring
}

Type guard

static boolean isMissingEditsRange(IOException ioe) {
  return ioe.getMessage() != null
      && ioe.getMessage().startsWith("No edits file for range");
}

Try / catch

try {
  File f = jnStorage.findFinalizedEditsFile(startTxId, endTxId);
} catch (IOException ioe) {
  if (isMissingEditsRange(ioe)) {
    // not a fault: this JN lacks the range — fail over to a peer JN
    // or trigger JournalNodeSyncer, then retry
  } else {
    throw ioe;
  }
}

Prevention

When it happens

Trigger: A getJournal/getedit HTTP request (standby tailer, JournalNodeSyncer, offline tooling) asks for a finalized range startTxId-endTxId, but that file was never finalized on this JN, was deleted, or the range requested does not match any finalized file name exactly (off-by-one end txid).

Common situations: A lagging JN that has not finalized the requested segment; a JN that was down during finalization; journal dir files removed by retention or by accident; requesting an in-progress range as if finalized; JN restored from a stale copy missing recent segments.

Related errors


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