private String readTailMagic(WALFileVersion version) throws IOException {
    int size = version.getVersionBytes().length;
    if (logFile.length() < size) {
      return null;
    }
    try (FileChannel channel = FileChannel.open(logFile.toPath(), StandardOpenOption.READ)) {
      ByteBuffer magicStringBytes = ByteBuffer.allocate(size);
      channel.read(magicStringBytes, channel.size() - size);
      magicStringBytes.flip();
      return new String(magicStringBytes.array(), StandardCharsets.UTF_8);
    }
  }
Check whether the wal file is broken and repair it.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/WALRepairWriter.java