{"record":{"id":"15af71f6787d7752","repo":"apache/hadoop","slug":"incorrect-data-format-times-operation","errorCode":null,"errorMessage":"Incorrect data format. times operation.","messagePattern":"Incorrect data format\\. times operation\\.","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java","lineNumber":2465,"sourceCode":"      return this;\n    }\n\n    @Override\n    public \n    void writeFields(DataOutputStream out) throws IOException {\n      FSImageSerialization.writeString(path, out);\n      FSImageSerialization.writeLong(mtime, out);\n      FSImageSerialization.writeLong(atime, out);\n    }\n\n    @Override\n    void readFields(DataInputStream in, int logVersion)\n        throws IOException {\n      if (!NameNodeLayoutVersion.supports(\n          LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {\n        this.length = in.readInt();\n        if (length != 3) {\n          throw new IOException(\"Incorrect data format. \" + \"times operation.\");\n        }\n      }\n      this.path = FSImageSerialization.readString(in);\n\n      if (NameNodeLayoutVersion.supports(\n          LayoutVersion.Feature.EDITLOG_OP_OPTIMIZATION, logVersion)) {\n        this.mtime = FSImageSerialization.readLong(in);\n        this.atime = FSImageSerialization.readLong(in);\n      } else {\n        this.mtime = readLong(in);\n        this.atime = readLong(in);\n      }\n    }\n\n    @Override\n    public String toString() {\n      StringBuilder builder = new StringBuilder();\n      builder.append(\"TimesOp [length=\")","sourceCodeStart":2447,"sourceCodeEnd":2483,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java#L2447-L2483","documentation":"TimesOp.readFields() (OP_TIMES, setTimes()): in legacy layouts without EDITLOG_OP_OPTIMIZATION the record's length word must be exactly 3 (path, mtime, atime). Any other value aborts the parse as malformed data.","triggerScenarios":"Corrupt length int at the start of an OP_TIMES record, or a misaligned stream after earlier truncation; reading a non-edits file.","commonSituations":"Crash-torn records on restart; unhealthy journal storage; mixed-version segments.","solutions":["Run 'hdfs namenode -recover' to skip the damaged record, then checkpoint","Pinpoint the failure with 'hdfs offlineEditsViewer -i <edits> -o out.xml'","Restore from a healthy journal copy or the last fsimage if too many records must be skipped"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"hdfs offlineEditsViewer -i <edits segment> -o /dev/null","typeGuard":null,"tryCatchPattern":"try {\n  reader.readOp();\n} catch (IOException e) {\n  if (e.getMessage().contains(\"times operation\")) {\n    // corrupt OP_TIMES record: recover via 'hdfs namenode -recover' or clean journal copy\n  } else { throw e; }\n}","preventionTips":["Journal quorum + healthy disks + frequent checkpoints, as with all edit-log corruption","Validate segments after any crash before restarting"],"tags":["hdfs","edit-log","corruption","times","legacy-format"],"backgroundTag":"edit-log-corruption","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}