{"record":{"id":"ccd67498547304e9","repo":"apache/hadoop","slug":"no-edits-file-for-txid-starttxid-endtx","errorCode":null,"errorMessage":"No edits file for txid \" + startTxId + \"-\" + endTxId + \" exists!","messagePattern":"No edits file for txid \" \\+ startTxId \\+ \"-\" \\+ endTxId \\+ \" exists!","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java","lineNumber":827,"sourceCode":"    return String.format(\"%s_%019d-%019d\", NameNodeFile.EDITS.getName(),\n                         startTxId, endTxId);\n  }\n\n  public static String getTemporaryEditsFileName(long startTxId, long endTxId,\n      long timestamp) {\n    return String.format(\"%s_%019d-%019d_%019d\",\n        NameNodeFile.EDITS_TMP.getName(), startTxId, endTxId, timestamp);\n  }\n  \n  /**\n   * Return the first readable finalized edits file for the given txid.\n   */\n  File findFinalizedEditsFile(long startTxId, long endTxId)\n  throws IOException {\n    File ret = findFile(NameNodeDirType.EDITS,\n        getFinalizedEditsFileName(startTxId, endTxId));\n    if (ret == null) {\n      throw new IOException(\n          \"No edits file for txid \" + startTxId + \"-\" + endTxId + \" exists!\");\n    }\n    return ret;\n  }\n    \n  /**\n   * Return the first readable image file for the given txid and image type, or\n   * null if no such image can be found.\n   */\n  File findImageFile(NameNodeFile nnf, long txid) {\n    return findFile(NameNodeDirType.IMAGE,\n        getNameNodeFileName(nnf, txid));\n  }\n\n  /**\n   * Return the first readable storage file of the given name\n   * across any of the 'current' directories in SDs of the\n   * given type, or null if no such file exists.","sourceCodeStart":809,"sourceCodeEnd":845,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L809-L845","documentation":"findFinalizedEditsFile scans EDITS-type storage directories for the finalized segment file edits_starttxid-endtxid and throws when no directory contains it. It is called from edit-log tailing, checkpoint alignment and recovery flows whenever a specific finalized segment must exist on local storage.","triggerScenarios":"Requesting a segment (getEdit download, recovery replay, rollback target) that was already purged by retention, deleted manually, lives only on an unavailable journal (NFS down, JournalNodes expelled), or whose txid range is simply wrong in tooling.","commonSituations":"Standby/2NN catching up asks for an old segment the Active already purged after checkpointing; a namespace restored from backup whose local edits are ahead or behind; manual pruning of edits dirs; retention settings aggressively deleting segments.","solutions":["List the finalized edits_* files actually present under each dfs.namenode.edits.dir and confirm the requested range is truly absent.","If purged, re-sync via a fresh checkpoint: the peer downloads the current image and only tails edits from its txid onward, no old segment needed.","Restore missing segments from JournalNodes (qjm) or backups before retrying recovery or tailing.","For 'hdfs namenode -recover', answer the prompt to skip the missing segment when offered."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before requesting a segment, confirm it is present locally\nFile[] present = new File(editsDir, \"current\").listFiles((d, n) ->\n    n.equals(String.format(\"edits_%019d-%019d\", startTxId, endTxId)));\nif (present == null || present.length == 0) {\n  // fall back to syncing from the current image instead of asking for a purged segment\n  throw new FileNotFoundException(\"Finalized segment \" + startTxId + \"-\" + endTxId + \" not on local storage\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  return storage.findFinalizedEditsFile(startTxId, endTxId);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"No edits file for txid\")) {\n    LOG.warn(\"Segment purged or absent; re-syncing from latest image instead\");\n    return downloadLatestImageAndTail();\n  }\n  throw e;\n}","preventionTips":["Keep edits retention (nameservice edits retention / checkpoint cadence) long enough for the slowest peer.","Never manually prune edits_* files without checking peer sync status.","Back up JournalNode data so purge segments are recoverable."],"tags":["hdfs","editlog","storage","recovery"],"backgroundTag":"missing-edit-log-segment","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}