private void clear(boolean resetSyncIndex, boolean cleanBaseDir) {
      // TsFilePiece Writing may out of RequestExecutor.lock, meaning that we must use additional
      // lock here to ensure serial execution of cleanup and write piece
      tsFilePieceReadWriteLock.writeLock().lock();
      try {
        this.reqExecutionOrderBuffer.clear();
        this.tsFileWriterPool.releaseAllWriters(consensusPipeName);
        this.tsFileEventCount.set(0);
        this.WALEventCount.set(0);
        if (resetSyncIndex) {
          this.onSyncedReplicateIndex = 0;
        }
        if (cleanBaseDir) {
          clearAllReceiverBaseDir();
        }
      } finally {
        tsFilePieceReadWriteLock.writeLock().unlock();
      }
    }
Reset all data to initial status and set connectorRebootTimes properly. This method is called
when receiver identifies connector has rebooted.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/pipeconsensus/PipeConsensusReceiver.java