public void rollToNextWritingPath() throws IOException, DiskSpaceInsufficientException {
      String receiverBasePath;
      try {
        receiverBasePath = getReceiverFileBaseDir();
      } catch (Exception e) {
        LOGGER.warn(
            "Failed to init pipeConsensus receiver file folder manager because all disks of folders are full.",
            e);
        throw e;
      }
      if (Objects.isNull(receiverBasePath)) {
        LOGGER.warn(
            "PipeConsensus-PipeName-{}: Failed to get pipeConsensus receiver file base directory, because folderManager is null. May because the disk is full.",
            consensusPipeName.toString());
        throw new DiskSpaceInsufficientException(receiveDirs);
      }

      String localWritingDirPath = receiverBasePath + File.separator + index;
      this.localWritingDir = new File(localWritingDirPath);
      // Remove exists dir
      deleteFileOrDirectoryIfExists(
          this.localWritingDir,
          String.format("TsFileWriter-%s roll to new dir and delete last writing dir", index));
      if (!this.localWritingDir.mkdirs()) {
        LOGGER.warn(
            "PipeConsensus-PipeName-{}: Failed to create receiver tsFileWriter-{} file dir {}. May because authority or dir already exists etc.",
            consensusPipeName,
            index,
            this.localWritingDir.getPath());
        throw new IOException(
            String.format(
                "PipeConsensus-PipeName-%s: Failed to create tsFileWriter-%d receiver file dir %s. May because authority or dir already exists etc.",
                consensusPipeName, index, this.localWritingDir.getPath()));
      }
      LOGGER.info(
          "PipeConsensus-PipeName-{}: tsfileWriter-{} roll to writing path {}",
          consensusPipeName,
          index,
          localWritingDirPath);
    }
This method cannot be set to synchronize. Receive events can be concurrent since reqBuffer but
load event must be synchronized.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/pipeconsensus/PipeConsensusReceiver.java