private void readNext() {
    currentIndex = inputStream.getReadBytes();
    try {
      nextSchemaPlan = deserializer.deserialize(inputStream);
    } catch (EOFException e) {
      // meet the end of the file, truncate the broken ending
      nextSchemaPlan = null;
      truncateBrokenLogs();
    } catch (IOException e) {
      // failed to read file
      nextSchemaPlan = null;
      isFileCorrupted = true;
      LOGGER.error(FILE_CORRUPTED_MSG_TEMPLATE, logFile.getPath(), currentIndex, e);
    } catch (Exception e) {
      // error occurred when deserializing the entry
      nextSchemaPlan = null;
      try {
        if (inputStream.available() > 0) {
          // error occurred when deserializing some middle part of the file
          isFileCorrupted = true;
          LOGGER.error(FILE_CORRUPTED_MSG_TEMPLATE, logFile.getPath(), currentIndex, e);
        } else {
          // the file has already been all read out, but error occurred during deserializing the
          // last entry in file ending.
          LOGGER.warn(e.getMessage(), e);
          truncateBrokenLogs();
        }
      } catch (IOException ex) {
        // failed to read file
        isFileCorrupted = true;
        LOGGER.error(FILE_CORRUPTED_MSG_TEMPLATE, logFile.getPath(), currentIndex, e);
      }
    }
  }
This class provides the common ability to read a log storing T. The corrupted file ending will be
truncate during read process. If some middle part of the log file is corrupted, the read process
will end and the file will be marked corrupted.

@param <T> the generic type
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/logfile/SchemaLogReader.java