{"record":{"id":"580e1ba741a420b5","repo":"apache/hadoop","slug":"no-edits-file-for-range","errorCode":null,"errorMessage":"No edits file for range {}-{}","messagePattern":"No edits file for range (.+?)-(.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java","lineNumber":98,"sourceCode":"    return fjm;\n  }\n\n  @Override\n  public boolean isPreUpgradableLayout(StorageDirectory sd)\n      throws IOException {\n    return false;\n  }\n\n  /**\n   * Find an edits file spanning the given transaction ID range.\n   * If no such file exists, an exception is thrown.\n   */\n  File findFinalizedEditsFile(long startTxId, long endTxId)\n      throws IOException {\n    File ret = new File(sd.getCurrentDir(),\n        NNStorage.getFinalizedEditsFileName(startTxId, endTxId));\n    if (!ret.exists()) {\n      throw new IOException(\n          \"No edits file for range \" + startTxId + \"-\" + endTxId);\n    }\n    return ret;\n  }\n\n  /**\n   * @return the path for an in-progress edits file starting at the given\n   * transaction ID. This does not verify existence of the file. \n   */\n  File getInProgressEditLog(long startTxId) {\n    return new File(sd.getCurrentDir(),\n        NNStorage.getInProgressEditsFileName(startTxId));\n  }\n  \n  /**\n   * @param segmentTxId the first txid of the segment\n   * @param epoch the epoch number of the writer which is coordinating\n   * recovery","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java#L80-L116","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["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.","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.","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.","If files were deleted accidentally, restore from backup or resync the JN entirely from a peer."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before asking for a finalized range, ask the JN what it actually holds\nRemoteEditLogManifest manifest =\n    qjm.getEditLogManifest(startTxId); // per-JN via QJournalProtocol\nboolean holds = manifest.getEditLogs().stream()\n    .anyMatch(l -> l.getStartTxId() == startTxId && l.getEndTxId() == endTxId);\nif (!holds) {\n  // ask a different JN or wait for this one to sync, instead of erroring\n}","typeGuard":"static boolean isMissingEditsRange(IOException ioe) {\n  return ioe.getMessage() != null\n      && ioe.getMessage().startsWith(\"No edits file for range\");\n}","tryCatchPattern":"try {\n  File f = jnStorage.findFinalizedEditsFile(startTxId, endTxId);\n} catch (IOException ioe) {\n  if (isMissingEditsRange(ioe)) {\n    // not a fault: this JN lacks the range — fail over to a peer JN\n    // or trigger JournalNodeSyncer, then retry\n  } else {\n    throw ioe;\n  }\n}","preventionTips":["Always validate requested ranges against the JN's manifest (getEditLogManifest) before streaming.","Enable dfs.journalnode.sync so lagging JNs catch up automatically.","Never hand-delete edits files from a JN's current dir."],"tags":["qjm","journalnode","missing-file","edit-log","finalized-segment"],"backgroundTag":"missing-editlog-segment","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}