public void receiveSnapshotFragment(
      String snapshotId, String originalFilePath, ByteBuffer fileChunk, long fileOffset)
      throws ConsensusGroupModifyPeerException {
    try {
      String targetFilePath = calculateSnapshotPath(snapshotId, originalFilePath);
      File targetFile = new File(storageDir, targetFilePath);
      Path parentDir = Paths.get(targetFile.getParent());
      if (!Files.exists(parentDir)) {
        Files.createDirectories(parentDir);
      }
      try (FileOutputStream fos = new FileOutputStream(targetFile.getAbsolutePath(), true);
          FileChannel channel = fos.getChannel()) {
        channel.write(fileChunk.slice(), fileOffset);
      }
    } catch (IOException e) {
      throw new ConsensusGroupModifyPeerException(
          String.format("error when receiving snapshot %s", snapshotId), e);
    }
  }
records the index of the log and writes locally, and then asynchronous replication is
performed.
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java