类 PartitionManager
- java.lang.Object
-
- org.apache.iotdb.confignode.manager.partition.PartitionManager
-
public class PartitionManager extends java.lang.ObjectThe PartitionManager Manages cluster PartitionTable read and write requests.
-
-
构造器概要
构造器 构造器 说明 PartitionManager(IManager configManager, PartitionInfo partitionInfo)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddMetrics()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 RegionGroupStatusintgenerateNextRegionGroupId()Only leader use this interfacejava.util.List<org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet>getAllReplicaSets()Only leader use this interfacejava.util.List<org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet>getAllReplicaSets(java.lang.String storageGroup)Only leader use this interface.java.util.List<org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet>getAllReplicaSets(org.apache.iotdb.common.rpc.thrift.TConsensusGroupType type)Only leader use this interface.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 interfaceorg.apache.iotdb.consensus.common.DataSetgetDataPartition(GetDataPartitionPlan req)Thread-safely get DataPartitionSchemaNodeManagementRespgetNodePathsPartition(GetNodePathsPartitionPlan physicalPlan)GetNodePathsPartitionDataPartitionRespgetOrCreateDataPartition(GetOrCreateDataPartitionPlan req)Get DataPartition and create a new one if it does not existSchemaPartitionRespgetOrCreateSchemaPartition(GetOrCreateSchemaPartitionPlan req)Get SchemaPartition and create a new one if it does not existorg.apache.iotdb.common.rpc.thrift.TConsensusGroupIdgetPrecededDataPartition(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.java.util.Map<org.apache.iotdb.common.rpc.thrift.TConsensusGroupId,RegionGroupCache>getRegionGroupCacheMap()intgetRegionGroupCount(java.lang.String storageGroup, org.apache.iotdb.common.rpc.thrift.TConsensusGroupType type)Only leader use this interface.RegionGroupStatusgetRegionGroupStatus(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId)Safely get RegionGroupStatusGetRegionIdRespgetRegionId(GetRegionIdPlan plan)RegionInfoListRespgetRegionInfoList(GetRegionInfoListPlan req)java.util.concurrent.ScheduledExecutorServicegetRegionMaintainer()org.apache.iotdb.commons.cluster.RegionStatusgetRegionStatus(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId, int dataNodeId)Safely get RegionStatusjava.lang.StringgetRegionStorageGroup(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId regionId)get database for regionorg.apache.iotdb.consensus.common.DataSetgetSchemaPartition(GetSchemaPartitionPlan req)Thread-safely get SchemaPartitionorg.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlotgetSeriesPartitionSlot(java.lang.String devicePath)Get TSeriesPartitionSlotGetSeriesSlotListRespgetSeriesSlotList(GetSeriesSlotListPlan plan)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)Only leader use this interface.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 DataGetTimeSlotListRespgetTimeSlotList(GetTimeSlotListPlan plan)voidinitRegionGroupHeartbeatCache()Initialize the regionGroupCacheMap when the ConfigNode-Leader is switchedvoidmaintainRegionReplicas()Called byregionMaintainervoidpreDeleteStorageGroup(java.lang.String storageGroup, PreDeleteStorageGroupPlan.PreDeleteType preDeleteType)voidremoveRegionGroupCache(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId)voidstartRegionCleaner()voidstopRegionCleaner()org.apache.iotdb.common.rpc.thrift.TSStatusupdateRegionLocation(UpdateRegionLocationPlan req)update region location
-
-
-
构造器详细资料
-
PartitionManager
public PartitionManager(IManager configManager, PartitionInfo partitionInfo)
-
-
方法详细资料
-
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- StorageGroupNameseriesPartitionSlot- Corresponding SeriesPartitionSlottimePartitionSlot- Corresponding TimePartitionSlottimePartitionInterval- 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 nametype- 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 StorageGroupNotExistsExceptionOnly leader use this interface.Get the number of RegionGroups currently owned by the specific StorageGroup
- 参数:
storageGroup- StorageGroupNametype- 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 NoAvailableRegionGroupExceptionOnly leader use this interface.- 参数:
storageGroup- StorageGroupNametype- 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
-
preDeleteStorageGroup
public void preDeleteStorageGroup(java.lang.String storageGroup, PreDeleteStorageGroupPlan.PreDeleteType preDeleteType)
-
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
-
getRegionInfoList
public RegionInfoListResp getRegionInfoList(GetRegionInfoListPlan req)
-
updateRegionLocation
public org.apache.iotdb.common.rpc.thrift.TSStatus updateRegionLocation(UpdateRegionLocationPlan req)
update region location- 参数:
req- UpdateRegionLocationReq- 返回:
- TSStatus
-
getRegionId
public GetRegionIdResp getRegionId(GetRegionIdPlan plan)
-
getTimeSlotList
public GetTimeSlotListResp getTimeSlotList(GetTimeSlotListPlan plan)
-
getSeriesSlotList
public GetSeriesSlotListResp getSeriesSlotList(GetSeriesSlotListPlan plan)
-
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 byregionMaintainerPeriodically 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 StorageGroupstatus- 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 RegionGroupIddataNodeId- 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()
-
-