类 QueryResourceManager


  • public class QueryResourceManager
    extends java.lang.Object
    QueryResourceManager manages resource (file streams) used by each query job, and assign Ids to the jobs. During the life cycle of a query, the following methods must be called in strict order:

    1. assignQueryId - get an Id for the new query.

    2. getQueryDataSource - open files for the job or reuse existing readers.

    3. endQueryForGivenJob - release the resource used by this job.

    • 方法详细资料

      • assignQueryId

        public long assignQueryId()
        Register a new query. When a query request is created firstly, this method must be invoked.
      • assignCompactionQueryId

        public long assignCompactionQueryId()
        Register a query id for compaction. The name of the compaction thread is 'pool-x-IoTDB-Compaction-xx', xx in which is usually an integer from 0 to MAXCOMPACTION_THREAD_NUM. We use the following rules to define query id for compaction:
        queryId = xx + Long.MIN_VALUE
      • registerTempExternalSortFile

        public void registerTempExternalSortFile​(long queryId,
                                                 IExternalSortFileDeserializer deserializer)
        register temporary file generated by external sort for resource release.
        参数:
        queryId - query job id
        deserializer - deserializer of temporary file in external sort.
      • initQueryDataSourceCache

        public void initQueryDataSourceCache​(java.util.Map<DataRegion,​java.util.List<org.apache.iotdb.commons.path.PartialPath>> processorToSeriesMap,
                                             QueryContext context,
                                             org.apache.iotdb.tsfile.read.filter.basic.Filter timeFilter)
                                      throws QueryProcessException
        The method is called in mergeLock() when executing query. This method will get all the QueryDataSource needed for this query and put them in the cachedQueryDataSourcesMap.
        参数:
        processorToSeriesMap - Key: processor of the data region. Value: selected series under the data region
        抛出:
        QueryProcessException
      • endQuery

        public void endQuery​(long queryId)
                      throws StorageEngineException
        Whenever the jdbc request is closed normally or abnormally, this method must be invoked. All query tokens created by this jdbc request must be cleared.
        抛出:
        StorageEngineException
      • writeQueryFileInfo

        public void writeQueryFileInfo()