public int setBlockLength(List<long[]> timestamps, int step) {
    double overlap = 0;
    long last_time = timestamps.get(0)[0];
    int i = step, blocks = 0;
    while (i < timestamps.size()) {
      long cur_time = timestamps.get(i)[0];
      if (last_time > cur_time) {
        overlap += 1;
      }
      last_time = cur_time;
      i += step;
      blocks += 1;
    }
    double ratio = overlap / blocks;
    int mul = (int) Math.ceil(ratio / INVERSION_RATIOS_THRESHOLD);
    // System.out.printf("Overlap ratio=%.4f mul=%d, step=%d\n", ratio, mul, step);
    // ensure inversion ratio < INVERSION_RATIOS_THRESHOLD
    if (mul <= 1) {
      return step * ARRAY_SIZE;
    }
    return setBlockLength(timestamps, mul * step);
  }
check block-inversions to find the proper block_size, which is a multiple of array_size. For
totally ordered, the block_size will equals to array_size For totally reverse ordered, the
block_size will equals to the rowCount. INVERSION_RATIOS_THRESHOLD=0.005 is a empiric value.

@param timestamps
@param step
@return
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/datastructure/BackwardSort.java