{"record":{"id":"52d269a3b7903e5e","repo":"apache/hadoop","slug":"getedit-failed","errorCode":null,"errorMessage":"getedit failed. {}","messagePattern":"getedit failed\\. (.+?)","errorType":"http","errorClass":"IOException","httpStatus":500,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/GetJournalEditServlet.java","lineNumber":238,"sourceCode":"              \"No edit log found starting at txid \" + segmentTxId);\n          return;\n        }\n        editFile = elf.getFile();\n        ImageServlet.setVerificationHeadersForGet(response, editFile);\n        ImageServlet.setFileNameHeaders(response, editFile);\n        editFileIn = new FileInputStream(editFile);\n      }\n      \n      DataTransferThrottler throttler = ImageServlet.getThrottler(conf);\n\n      // send edits\n      TransferFsImage.copyFileToStream(response.getOutputStream(), editFile,\n          editFileIn, throttler);\n\n    } catch (Throwable t) {\n      String errMsg = \"getedit failed. \" + StringUtils.stringifyException(t);\n      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, errMsg);\n      throw new IOException(errMsg);\n    } finally {\n      IOUtils.closeStream(editFileIn);\n    }\n  }\n\n  public static String buildPath(String journalId, long segmentTxId,\n      NamespaceInfo nsInfo, boolean inProgressOk) {\n    StringBuilder path = new StringBuilder(\"/getJournal?\");\n    try {\n      path.append(JOURNAL_ID_PARAM).append(\"=\")\n          .append(URLEncoder.encode(journalId, \"UTF-8\"));\n      path.append(\"&\" + SEGMENT_TXID_PARAM).append(\"=\")\n          .append(segmentTxId);\n      path.append(\"&\" + STORAGEINFO_PARAM).append(\"=\")\n          .append(URLEncoder.encode(nsInfo.toColonSeparatedString(), \"UTF-8\"));\n      path.append(\"&\" + IN_PROGRESS_OK).append(\"=\")\n          .append(inProgressOk);\n    } catch (UnsupportedEncodingException e) {","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/GetJournalEditServlet.java#L220-L256","documentation":"GetJournalEditServlet is the JournalNode's HTTP endpoint (paths /getJournal and /getedit) that streams edit log files to clients such as the standby NameNode's EditLogTailer and journal sync. This catch-all handler fires when anything goes wrong while locating, opening, or streaming the edit file: it returns HTTP 500 and rethrows IOException with the stringified root cause appended.","triggerScenarios":"A client requests /getedit or /getJournal for a segment and the JN hits a FileNotFoundException (segment missing on this JN), an IO error reading the file (disk failure), a throttler/streaming error, or the client disconnects mid-transfer so writing to response.getOutputStream() throws.","commonSituations":"Standby NN tailer requests a segment the JN has not finalized yet; JN disk failing or file deleted; client (tailer/NN) times out and closes the connection first; dfs.image.transfer.bandwidthPerSec throttling misconfigured; firewall/proxy truncating the HTTP transfer.","solutions":["Look at the JN log entry for the same request — the stringified cause after 'getedit failed.' names the real problem (FileNotFoundException, SocketException broken pipe, IOException read error).","If the cause is a missing file, list the JN's current dir to see which finalized segments it actually has and let JournalNodeSyncer (or a manual copy from a healthy JN) bring it in sync.","If the cause is 'broken pipe'/client abort, fix the client side (edit-tailer timeouts, proxy idle timeouts) rather than the JN.","If the cause is a read/disk error, replace or repair the JN disk and restore its journal dir from a healthy JN."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before tailing/syncing, confirm the JN holds the finalized segment\n// by checking its file listing (JN dir on the JN host):\n//   ls current/edits_<start>-<end>  -> must exist and be non-empty\nPath expected = currentDir.resolve(\n    NNStorage.getFinalizedEditsFileName(startTxId, endTxId));\nif (!Files.exists(expected)) {\n  throw new FileNotFoundException(\"Segment absent on this JN: \" + expected);\n}","typeGuard":"static boolean isGetEditFailure(IOException ioe) {\n  return ioe.getMessage() != null && ioe.getMessage().startsWith(\"getedit failed\");\n}","tryCatchPattern":"try {\n  fetchEditLogSegment(jnHttpUri);\n} catch (IOException ioe) {\n  if (isGetEditFailure(ioe)) {\n    String root = ioe.getMessage();\n    if (root.contains(\"FileNotFoundException\")) pickAnotherJnOrWait();\n    else if (root.contains(\"broken pipe\") || root.contains(\"SocketException\")) {\n      // our side closed early: widen our read/idle timeouts, then retry\n    } else throw ioe;\n  } else throw ioe;\n}","preventionTips":["Tailer/sync clients should treat a JN 500 as 'try another JN' — always have fallback JN addresses.","Keep client HTTP read/idle timeouts generous enough for throttled (dfs.image.transfer.bandwidthPerSec) transfers.","Monitor JN disks; most 'getedit failed' root causes are missing files or bad disks visible in the JN log."],"tags":["qjm","journalnode","http-servlet","edit-log","streaming"],"backgroundTag":"http-file-transfer-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}