apache/hadoop · error · IOException
Incorrect data format. delete operation.
Error message
Incorrect data format. delete operation.
What it means
DeleteOp.readFields(): in legacy layouts without EDITLOG_OP_OPTIMIZATION the record starts with a length word that must be exactly 2 (path, timestamp). A different value means the bytes are not a well-formed delete record, so the reader refuses to continue.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java:1562
return this;
}
@Override
public
void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(path, out);
FSImageSerialization.writeLong(timestamp, out);
writeRpcIds(rpcClientId, rpcCallId, out);
}
@Override
void readFields(DataInputStream in, int logVersion)
throws IOException {
if (!NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.length = in.readInt();
if (this.length != 2) {
throw new IOException("Incorrect data format. " + "delete operation.");
}
}
this.path = FSImageSerialization.readString(in);
if (NameNodeLayoutVersion.supports(
LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {
this.timestamp = FSImageSerialization.readLong(in);
} else {
this.timestamp = readLong(in);
}
// read RPC ids if necessary
readRpcIds(in, logVersion);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DeleteOp [length=")
.append(length)View on GitHub (pinned to 2add963021)
Solutions
- Run 'hdfs namenode -recover' and answer yes to skip the damaged edit
- Confirm the extent of damage with 'hdfs offlineEditsViewer'
- Fall back to the last fsimage checkpoint or a healthy journal copy
Defensive patterns
Strategy: try-catch
Validate before calling
hdfs offlineEditsViewer -i <edits segment> -o /dev/null
Try / catch
try {
reader.readOp();
} catch (IOException e) {
if (e.getMessage().contains("delete operation")) {
// corrupt OP_DELETE record: skip via 'hdfs namenode -recover' or restore clean copy
} else { throw e; }
} Prevention
- Unclean shutdowns are the usual producer: always stop the NameNode cleanly
- Keep journal disks healthy and monitored
- Take checkpoints so replay of old segments is short
When it happens
Trigger: A corrupt length int at the head of a delete record, or a misaligned stream after an earlier truncated record; parsing non-edits data as an edit log.
Common situations: Crash mid-write leaving a partial OP_DELETE record; failing disks; segments from mixed Hadoop versions in one name dir.
Related errors
- Incorrect data format for ConcatDeleteOp.
- Incorrect data format. ConcatDeleteOp cannot have a negative
- Incorrect data format. Old rename operation.
- Incorrect data format. Mkdir operation.
- Incorrect data format. times operation.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/aafa0c8d63f89c08.
Report an issue: GitHub.