apache/hadoop · error · IOException

getedit failed. {}

Error message

getedit failed. {}

What it means

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.

Source

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

              "No edit log found starting at txid " + segmentTxId);
          return;
        }
        editFile = elf.getFile();
        ImageServlet.setVerificationHeadersForGet(response, editFile);
        ImageServlet.setFileNameHeaders(response, editFile);
        editFileIn = new FileInputStream(editFile);
      }
      
      DataTransferThrottler throttler = ImageServlet.getThrottler(conf);

      // send edits
      TransferFsImage.copyFileToStream(response.getOutputStream(), editFile,
          editFileIn, throttler);

    } catch (Throwable t) {
      String errMsg = "getedit failed. " + StringUtils.stringifyException(t);
      response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, errMsg);
      throw new IOException(errMsg);
    } finally {
      IOUtils.closeStream(editFileIn);
    }
  }

  public static String buildPath(String journalId, long segmentTxId,
      NamespaceInfo nsInfo, boolean inProgressOk) {
    StringBuilder path = new StringBuilder("/getJournal?");
    try {
      path.append(JOURNAL_ID_PARAM).append("=")
          .append(URLEncoder.encode(journalId, "UTF-8"));
      path.append("&" + SEGMENT_TXID_PARAM).append("=")
          .append(segmentTxId);
      path.append("&" + STORAGEINFO_PARAM).append("=")
          .append(URLEncoder.encode(nsInfo.toColonSeparatedString(), "UTF-8"));
      path.append("&" + IN_PROGRESS_OK).append("=")
          .append(inProgressOk);
    } catch (UnsupportedEncodingException e) {

View on GitHub (pinned to 2add963021)

Solutions

  1. 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).
  2. 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.
  3. If the cause is 'broken pipe'/client abort, fix the client side (edit-tailer timeouts, proxy idle timeouts) rather than the JN.
  4. If the cause is a read/disk error, replace or repair the JN disk and restore its journal dir from a healthy JN.
Defensive patterns

Strategy: try-catch

Validate before calling

// Before tailing/syncing, confirm the JN holds the finalized segment
// by checking its file listing (JN dir on the JN host):
//   ls current/edits_<start>-<end>  -> must exist and be non-empty
Path expected = currentDir.resolve(
    NNStorage.getFinalizedEditsFileName(startTxId, endTxId));
if (!Files.exists(expected)) {
  throw new FileNotFoundException("Segment absent on this JN: " + expected);
}

Type guard

static boolean isGetEditFailure(IOException ioe) {
  return ioe.getMessage() != null && ioe.getMessage().startsWith("getedit failed");
}

Try / catch

try {
  fetchEditLogSegment(jnHttpUri);
} catch (IOException ioe) {
  if (isGetEditFailure(ioe)) {
    String root = ioe.getMessage();
    if (root.contains("FileNotFoundException")) pickAnotherJnOrWait();
    else if (root.contains("broken pipe") || root.contains("SocketException")) {
      // our side closed early: widen our read/idle timeouts, then retry
    } else throw ioe;
  } else throw ioe;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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