apache/hadoop · error · IOException

Gap in transactions. Expected to be able to read up until at

Error message

Gap in transactions. Expected to be able to read up until at least txid %d but unable to find any edit logs containing txid %d

What it means

Error "Gap in transactions. Expected to be able to read up until at least txid %d but unable to find any edit logs containing txid %d" thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java:1827

    while (true) {
      if (txId > toAtLeastTxId) return;
      if (!iter.hasNext()) break;
      EditLogInputStream elis = iter.next();
      if (elis.getFirstTxId() > txId) break;
      long next = elis.getLastTxId();
      if (next == HdfsServerConstants.INVALID_TXID) {
        if (!inProgressOk) {
          throw new RuntimeException("inProgressOk = false, but " +
              "selectInputStreams returned an in-progress edit " +
              "log input stream (" + elis + ")");
        }
        // We don't know where the in-progress stream ends.
        // It could certainly go all the way up to toAtLeastTxId.
        return;
      }
      txId = next + 1;
    }
    throw new IOException(String.format("Gap in transactions. Expected to "
        + "be able to read up until at least txid %d but unable to find any "
        + "edit logs containing txid %d", toAtLeastTxId, txId));
  }

  /** 
   * Close all the streams in a collection
   * @param streams The list of streams to close
   */
  static void closeAllStreams(Iterable<EditLogInputStream> streams) {
    for (EditLogInputStream s : streams) {
      IOUtils.closeStream(s);
    }
  }

  /**
   * Retrieve the implementation class for a Journal scheme.
   * @param conf The configuration to retrieve the information from
   * @param uriScheme The uri scheme to look up.

View on GitHub (pinned to 2add963021)

Solutions

  1. Recover missing edit log segments from other journals or the standby NameNode.
  2. If the gap cannot be recovered, run the NameNode recovery mode (hdfs namenode -recover) or restore from a checkpoint, accepting possible data loss.

When it happens

Trigger: Loading edits where a transaction range is missing from all available edit logs, leaving a gap in the transaction sequence.

Common situations: See trigger scenarios.


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