public void reserveFromFreeMemoryForOperators(
      final long memoryInBytes,
      final long reservedBytes,
      final String queryId,
      final String contextHolder) {
    if (OPERATORS_MEMORY_BLOCK.allocate(memoryInBytes)) {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(
            "[ConsumeMemory] consume: {}, current remaining memory: {}",
            memoryInBytes,
            OPERATORS_MEMORY_BLOCK.getFreeMemoryInBytes());
      }
    } else {
      throw new MemoryNotEnoughException(
          String.format(
              "There is not enough memory for Query %s, the contextHolder is %s,"
                  + "current remaining free memory is %dB, "
                  + "already reserved memory for this context in total is %dB, "
                  + "the memory requested this time is %dB",
              queryId,
              contextHolder,
              OPERATORS_MEMORY_BLOCK.getFreeMemoryInBytes(),
              reservedBytes,
              memoryInBytes));
    }
  }
Used to plan a fragment instance. One fragment instance could be split into multiple pipelines so
that a fragment instance could be run in parallel, and thus we can take full advantages of
multi-cores.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LocalExecutionPlanner.java