private boolean insertTabletToTsFileProcessor(
      InsertTabletNode insertTabletNode,
      List<int[]> rangeList,
      boolean sequence,
      TSStatus[] results,
      long timePartitionId,
      boolean noFailure,
      long[] infoForMetrics) {
    if (insertTabletNode.allMeasurementFailed()) {
      if (logger.isDebugEnabled()) {
        logger.debug(
            "Won't insert tablet {}, because {}",
            insertTabletNode.getSearchIndex(),
            "insertTabletNode allMeasurementFailed");
      }
      return true;
    }

    TsFileProcessor tsFileProcessor = getOrCreateTsFileProcessor(timePartitionId, sequence);
    if (tsFileProcessor == null) {
      for (int[] rangePair : rangeList) {
        int start = rangePair[0];
        int end = rangePair[1];
        for (int i = start; i < end; i++) {
          results[i] =
              RpcUtils.getStatus(
                  TSStatusCode.INTERNAL_SERVER_ERROR,
                  "can not create TsFileProcessor, timePartitionId: " + timePartitionId);
        }
      }
      return false;
    }

    // register TableSchema (and maybe more) for table insertion
    registerToTsFile(insertTabletNode, tsFileProcessor);

    try {
      tsFileProcessor.insertTablet(insertTabletNode, rangeList, results, noFailure, infoForMetrics);
    } catch (WriteProcessRejectException e) {
      logger.warn("insert to TsFileProcessor rejected, {}", e.getMessage());
      return false;
    } catch (WriteProcessException e) {
      logger.error("insert to TsFileProcessor error ", e);
      return false;
    }

    // check memtable size and may async try to flush the work memtable
    if (tsFileProcessor.shouldFlush()) {
      fileFlushPolicy.apply(this, tsFileProcessor, sequence);
    }
    return true;
  }
insert batch to tsfile processor thread-safety that the caller need to guarantee The rows to be
inserted are in the range [start, end) Null value in each column values will be replaced by the
subsequent non-null value, e.g., {1, null, 3, null, 5} will be {1, 3, 5, null, 5}

@param insertTabletNode insert a tablet of a device
@param sequence whether is sequence
@param rangeList start and end index list of rows to be inserted in insertTabletPlan
@param results result array
@param timePartitionId time partition id
@return false if any failure occurs when inserting the tablet, true otherwise
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java