类 PartitionInfo

  • 所有已实现的接口:
    org.apache.iotdb.commons.snapshot.SnapshotProcessor

    public class PartitionInfo
    extends java.lang.Object
    implements org.apache.iotdb.commons.snapshot.SnapshotProcessor
    The PartitionInfo stores cluster PartitionTable. The PartitionTable including: 1. regionMap: location of Region member 2. schemaPartition: location of schema 3. dataPartition: location of data
    • 构造器详细资料

      • PartitionInfo

        public PartitionInfo()
    • 方法详细资料

      • generateNextRegionGroupId

        public int generateNextRegionGroupId()
      • setStorageGroup

        public org.apache.iotdb.common.rpc.thrift.TSStatus setStorageGroup​(SetStorageGroupPlan plan)
        Thread-safely create new StorageGroupPartitionInfo
        参数:
        plan - SetStorageGroupPlan
        返回:
        SUCCESS_STATUS if the new StorageGroupPartitionInfo is created successfully.
      • createRegionGroups

        public org.apache.iotdb.common.rpc.thrift.TSStatus createRegionGroups​(CreateRegionGroupsPlan plan)
        Thread-safely cache allocation result of new RegionGroups
        参数:
        plan - CreateRegionGroupsPlan
        返回:
        SUCCESS_STATUS
      • offerRegionMaintainTasks

        public org.apache.iotdb.common.rpc.thrift.TSStatus offerRegionMaintainTasks​(OfferRegionMaintainTasksPlan offerRegionMaintainTasksPlan)
        Offer a batch of RegionMaintainTasks for the RegionMaintainer
        返回:
        SUCCESS_STATUS
      • pollRegionMaintainTask

        public org.apache.iotdb.common.rpc.thrift.TSStatus pollRegionMaintainTask()
        Poll the head of RegionMaintainTasks from the regionMaintainTaskList after it's executed successfully
        返回:
        SUCCESS_STATUS
      • getRegionMaintainEntryList

        public java.util.List<RegionMaintainTask> getRegionMaintainEntryList()
        Get a deep copy of RegionCleanList for RegionCleaner to maintain cluster RegionReplicas
        返回:
        A deep copy of RegionCleanList
      • preDeleteStorageGroup

        public org.apache.iotdb.common.rpc.thrift.TSStatus preDeleteStorageGroup​(PreDeleteStorageGroupPlan preDeleteStorageGroupPlan)
        Thread-safely pre-delete the specific StorageGroup
        参数:
        preDeleteStorageGroupPlan - PreDeleteStorageGroupPlan
        返回:
        SUCCESS_STATUS
      • deleteStorageGroup

        public void deleteStorageGroup​(DeleteStorageGroupPlan plan)
        Thread-safely delete StorageGroup
        参数:
        plan - DeleteStorageGroupPlan
      • getSchemaPartition

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

        public org.apache.iotdb.consensus.common.DataSet getDataPartition​(GetDataPartitionPlan plan)
        Thread-safely get DataPartition
        参数:
        plan - DataPartitionPlan with partitionSlotsMap
        返回:
        DataPartitionDataSet that contains only existing DataPartition
      • 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)
        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
      • createSchemaPartition

        public org.apache.iotdb.common.rpc.thrift.TSStatus createSchemaPartition​(CreateSchemaPartitionPlan plan)
        Create SchemaPartition
        参数:
        plan - CreateSchemaPartitionPlan with SchemaPartition assigned result
        返回:
        TSStatusCode.SUCCESS_STATUS
      • createDataPartition

        public org.apache.iotdb.common.rpc.thrift.TSStatus createDataPartition​(CreateDataPartitionPlan plan)
        Create DataPartition
        参数:
        plan - CreateDataPartitionPlan with DataPartition assigned result
        返回:
        TSStatusCode.SUCCESS_STATUS
      • getSchemaNodeManagementPartition

        public org.apache.iotdb.consensus.common.DataSet getSchemaNodeManagementPartition​(java.util.List<java.lang.String> matchedStorageGroups)
        Get SchemaNodeManagementPartition through matched storageGroup
      • getRegionInfoList

        public org.apache.iotdb.consensus.common.DataSet getRegionInfoList​(GetRegionInfoListPlan regionsInfoPlan)
        Get region information
      • updateRegionLocation

        public org.apache.iotdb.common.rpc.thrift.TSStatus updateRegionLocation​(UpdateRegionLocationPlan req)
        Update the location info of given regionId
        参数:
        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
      • filterUnassignedSchemaPartitionSlots

        public java.util.Map<java.lang.String,​java.util.List<org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot>> filterUnassignedSchemaPartitionSlots​(java.util.Map<java.lang.String,​java.util.List<org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot>> partitionSlotsMap)
        Only Leader use this interface. Filter unassigned SchemaPartitionSlots
        参数:
        partitionSlotsMap - Map>
        返回:
        Map>, SchemaPartitionSlots that is not assigned in partitionSlotsMap
      • filterUnassignedDataPartitionSlots

        public java.util.Map<java.lang.String,​java.util.Map<org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot,​org.apache.iotdb.confignode.rpc.thrift.TTimeSlotList>> filterUnassignedDataPartitionSlots​(java.util.Map<java.lang.String,​java.util.Map<org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot,​org.apache.iotdb.confignode.rpc.thrift.TTimeSlotList>> partitionSlotsMap)
        Only Leader use this interface. Filter unassigned SchemaPartitionSlots
        参数:
        partitionSlotsMap - Map>
        返回:
        Map>, DataPartitionSlots that is not assigned in partitionSlotsMap
      • 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 specified StorageGroup

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

        public int getAssignedSeriesPartitionSlotsCount​(java.lang.String storageGroup)
      • 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
      • getRegionGroupSlotsCounter

        public java.util.List<org.apache.iotdb.tsfile.utils.Pair<java.lang.Long,​org.apache.iotdb.common.rpc.thrift.TConsensusGroupId>> getRegionGroupSlotsCounter​(java.lang.String storageGroup,
                                                                                                                                                                        org.apache.iotdb.common.rpc.thrift.TConsensusGroupType type)
        Only leader use this interface.
        参数:
        storageGroup - StorageGroupName
        type - SchemaRegion or DataRegion
        返回:
        The StorageGroup's Running or Available Regions that sorted by the number of allocated slots
      • updateRegionGroupMetric

        public int updateRegionGroupMetric​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupType type)
        Update RegionGroup-related metric
        参数:
        type - SchemaRegion or DataRegion
        返回:
        the number of SchemaRegion or DataRegion
      • processTakeSnapshot

        public boolean processTakeSnapshot​(java.io.File snapshotDir)
                                    throws org.apache.thrift.TException,
                                           java.io.IOException
        指定者:
        processTakeSnapshot 在接口中 org.apache.iotdb.commons.snapshot.SnapshotProcessor
        抛出:
        org.apache.thrift.TException
        java.io.IOException
      • processLoadSnapshot

        public void processLoadSnapshot​(java.io.File snapshotDir)
                                 throws org.apache.thrift.TException,
                                        java.io.IOException
        指定者:
        processLoadSnapshot 在接口中 org.apache.iotdb.commons.snapshot.SnapshotProcessor
        抛出:
        org.apache.thrift.TException
        java.io.IOException
      • getRegionId

        public org.apache.iotdb.consensus.common.DataSet getRegionId​(GetRegionIdPlan plan)
      • getTimeSlotList

        public org.apache.iotdb.consensus.common.DataSet getTimeSlotList​(GetTimeSlotListPlan plan)
      • getSeriesSlotList

        public org.apache.iotdb.consensus.common.DataSet getSeriesSlotList​(GetSeriesSlotListPlan plan)
      • getStorageGroupPartitionTableSize

        public int getStorageGroupPartitionTableSize()
      • clear

        public void clear()
      • equals

        public boolean equals​(java.lang.Object o)
        覆盖:
        equals 在类中 java.lang.Object
      • hashCode

        public int hashCode()
        覆盖:
        hashCode 在类中 java.lang.Object