类 PartitionManager


  • public class PartitionManager
    extends java.lang.Object
    The PartitionManager Manages cluster PartitionTable read and write requests.
    • 构造器详细资料

    • 方法详细资料

      • getSchemaPartition

        public org.apache.iotdb.consensus.common.DataSet getSchemaPartition​(GetSchemaPartitionPlan req)
        Thread-safely get SchemaPartition
        参数:
        req - SchemaPartitionPlan with partitionSlotsMap
        返回:
        SchemaPartitionDataSet that contains only existing SchemaPartition
      • getDataPartition

        public org.apache.iotdb.consensus.common.DataSet getDataPartition​(GetDataPartitionPlan req)
        Thread-safely get DataPartition
        参数:
        req - DataPartitionPlan with Map>
        返回:
        DataPartitionDataSet that contains only existing DataPartition
      • getOrCreateSchemaPartition

        public SchemaPartitionResp getOrCreateSchemaPartition​(GetOrCreateSchemaPartitionPlan req)
        Get SchemaPartition and create a new one if it does not exist
        参数:
        req - SchemaPartitionPlan with partitionSlotsMap
        返回:
        SchemaPartitionResp with DataPartition and TSStatus. SUCCESS_STATUS if all process finish. NOT_ENOUGH_DATA_NODE if the DataNodes is not enough to create new Regions. STORAGE_GROUP_NOT_EXIST if some StorageGroup don't exist.
      • getOrCreateDataPartition

        public DataPartitionResp getOrCreateDataPartition​(GetOrCreateDataPartitionPlan req)
        Get DataPartition and create a new one if it does not exist
        参数:
        req - DataPartitionPlan with Map>>
        返回:
        DataPartitionResp with DataPartition and TSStatus. SUCCESS_STATUS if all process finish. NOT_ENOUGH_DATA_NODE if the DataNodes is not enough to create new Regions. STORAGE_GROUP_NOT_EXIST if some StorageGroup don't exist.
      • getPrecededDataPartition

        public org.apache.iotdb.common.rpc.thrift.TConsensusGroupId getPrecededDataPartition​(java.lang.String storageGroup,
                                                                                             org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot seriesPartitionSlot,
                                                                                             org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot timePartitionSlot,
                                                                                             long timePartitionInterval)
        Only leader use this interface. Checks whether the specified DataPartition has a predecessor and returns if it does
        参数:
        storageGroup - StorageGroupName
        seriesPartitionSlot - Corresponding SeriesPartitionSlot
        timePartitionSlot - Corresponding TimePartitionSlot
        timePartitionInterval - Time partition interval
        返回:
        The specific DataPartition's predecessor if exists, null otherwise
      • getStorageGroupRelatedDataNodes

        public java.util.Set<org.apache.iotdb.common.rpc.thrift.TDataNodeLocation> getStorageGroupRelatedDataNodes​(java.lang.String storageGroup,
                                                                                                                   org.apache.iotdb.common.rpc.thrift.TConsensusGroupType type)
        Get the DataNodes who contain the specific StorageGroup's Schema or Data
        参数:
        storageGroup - The specific StorageGroup's name
        type - SchemaRegion or DataRegion
        返回:
        Set, the related DataNodes
      • getAllReplicaSetsMap

        public java.util.Map<org.apache.iotdb.common.rpc.thrift.TConsensusGroupId,​org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet> getAllReplicaSetsMap​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupType type)
        Only leader use this interface
        参数:
        type - The specified TConsensusGroupType
        返回:
        Deep copy of all Regions' RegionReplicaSet and organized to Map
      • getAllReplicaSets

        public java.util.List<org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet> getAllReplicaSets()
        Only leader use this interface
        返回:
        Deep copy of all Regions' RegionReplicaSet
      • getAllReplicaSets

        public java.util.List<org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet> getAllReplicaSets​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupType type)
        Only leader use this interface.
        参数:
        type - The specified TConsensusGroupType
        返回:
        Deep copy of all Regions' RegionReplicaSet with the specified TConsensusGroupType
      • getAllReplicaSets

        public java.util.List<org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet> getAllReplicaSets​(java.lang.String storageGroup)
        Only leader use this interface.
        参数:
        storageGroup - The specified StorageGroup
        返回:
        All Regions' RegionReplicaSet of the specified StorageGroup
      • getRegionGroupCount

        public int getRegionGroupCount​(java.lang.String storageGroup,
                                       org.apache.iotdb.common.rpc.thrift.TConsensusGroupType type)
                                throws StorageGroupNotExistsException
        Only leader use this interface.

        Get the number of RegionGroups currently owned by the specific StorageGroup

        参数:
        storageGroup - StorageGroupName
        type - SchemaRegion or DataRegion
        返回:
        Number of Regions currently owned by the specific StorageGroup
        抛出:
        StorageGroupNotExistsException - When the specific StorageGroup doesn't exist
      • getSortedRegionGroupSlotsCounter

        public java.util.List<org.apache.iotdb.tsfile.utils.Pair<java.lang.Long,​org.apache.iotdb.common.rpc.thrift.TConsensusGroupId>> getSortedRegionGroupSlotsCounter​(java.lang.String storageGroup,
                                                                                                                                                                              org.apache.iotdb.common.rpc.thrift.TConsensusGroupType type)
                                                                                                                                                                       throws NoAvailableRegionGroupException
        Only leader use this interface.
        参数:
        storageGroup - StorageGroupName
        type - SchemaRegion or DataRegion
        返回:
        The specific StorageGroup's Regions that sorted by the number of allocated slots
        抛出:
        NoAvailableRegionGroupException - When all RegionGroups within the specified StorageGroup are unavailable currently
      • generateNextRegionGroupId

        public int generateNextRegionGroupId()
        Only leader use this interface
        返回:
        the next RegionGroupId
      • getNodePathsPartition

        public SchemaNodeManagementResp getNodePathsPartition​(GetNodePathsPartitionPlan physicalPlan)
        GetNodePathsPartition
        参数:
        physicalPlan - GetNodesPathsPartitionReq
        返回:
        SchemaNodeManagementPartitionDataSet that contains only existing matched SchemaPartition and matched child paths aboveMTree
      • addMetrics

        public void addMetrics()
      • getSeriesPartitionSlot

        public org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot getSeriesPartitionSlot​(java.lang.String devicePath)
        Get TSeriesPartitionSlot
        参数:
        devicePath - Full path ending with device name
        返回:
        SeriesPartitionSlot
      • updateRegionLocation

        public org.apache.iotdb.common.rpc.thrift.TSStatus updateRegionLocation​(UpdateRegionLocationPlan req)
        update region location
        参数:
        req - UpdateRegionLocationReq
        返回:
        TSStatus
      • getRegionStorageGroup

        public java.lang.String getRegionStorageGroup​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId regionId)
        get database for region
        参数:
        regionId - regionId
        返回:
        database name
      • maintainRegionReplicas

        public void maintainRegionReplicas()
        Called by regionMaintainer

        Periodically maintain the RegionReplicas to be created or deleted

      • startRegionCleaner

        public void startRegionCleaner()
      • stopRegionCleaner

        public void stopRegionCleaner()
      • getRegionGroupCacheMap

        public java.util.Map<org.apache.iotdb.common.rpc.thrift.TConsensusGroupId,​RegionGroupCache> getRegionGroupCacheMap()
      • removeRegionGroupCache

        public void removeRegionGroupCache​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId)
      • filterRegionGroupThroughStatus

        public java.util.List<org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet> filterRegionGroupThroughStatus​(java.lang.String storageGroup,
                                                                                                                   RegionGroupStatus... status)
        Filter the RegionGroups in the specified StorageGroup through the RegionGroupStatus
        参数:
        storageGroup - The specified StorageGroup
        status - The specified RegionGroupStatus
        返回:
        Filtered RegionGroups with the specific RegionGroupStatus
      • getRegionStatus

        public org.apache.iotdb.commons.cluster.RegionStatus getRegionStatus​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId,
                                                                             int dataNodeId)
        Safely get RegionStatus
        参数:
        consensusGroupId - Specified RegionGroupId
        dataNodeId - Specified RegionReplicaId
        返回:
        Corresponding RegionStatus if cache exists, Unknown otherwise
      • getRegionGroupStatus

        public RegionGroupStatus getRegionGroupStatus​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId)
        Safely get RegionGroupStatus
        参数:
        consensusGroupId - Specified RegionGroupId
        返回:
        Corresponding RegionGroupStatus if cache exists, Disabled otherwise
      • initRegionGroupHeartbeatCache

        public void initRegionGroupHeartbeatCache()
        Initialize the regionGroupCacheMap when the ConfigNode-Leader is switched
      • getRegionMaintainer

        public java.util.concurrent.ScheduledExecutorService getRegionMaintainer()