@Override
  public void mayTruncateLastLine() {
    try (RandomAccessFile file = new RandomAccessFile(filePath, "r")) {
      long filePointer = file.length() - 1;
      if (filePointer <= 0) {
        return;
      }

      file.seek(filePointer);
      byte lastChar = file.readByte();
      if (lastChar != '\n') {
        while (filePointer > -1 && lastChar != '\n') {
          file.seek(filePointer);
          filePointer--;
          lastChar = file.readByte();
        }
        logger.warn("The last line of Mods is incomplete, will be truncated");
        truncate(filePointer + 2);
      }
    } catch (IOException e) {
      logger.error("An error occurred when reading modifications", e);
    }
  }
Construct a LocalTextModificationAccessor using a file specified by filePath.

@param filePath the path of the file that is used for storing modifications.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/modification/v1/io/LocalTextModificationAccessor.java