Class DatabasePartitionTable
java.lang.Object
org.apache.iotdb.confignode.persistence.partition.DatabasePartitionTable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidautoCleanPartitionTable(long TTL, TTimePartitionSlot currentTimeSlot) Remove PartitionTable where the TimeSlot is expired.booleancontainRegionGroup(TConsensusGroupId regionId) Check if the DatabasePartitionTable contains the specified Region.voidcountDataNodeScatterWidth(int dataNodeId, TConsensusGroupType type, BitSet scatterSet) Only leader use this interface.voidcreateDataPartition(DataPartitionTable assignedDataPartition) Create DataPartition within the specific StorageGroup.voidcreateRegionGroups(List<TRegionReplicaSet> replicaSets) Cache allocation result of new RegionGroups.voidcreateSchemaPartition(SchemaPartitionTable assignedSchemaPartition) Create SchemaPartition within the specific StorageGroup.voiddeserialize(InputStream inputStream, org.apache.thrift.protocol.TProtocol protocol) booleanfilterUnassignedDataPartitionSlots(Map<TSeriesPartitionSlot, TTimeSlotList> partitionSlots) Only Leader use this interface.filterUnassignedSchemaPartitionSlots(List<TSeriesPartitionSlot> partitionSlots) Only Leader use this interface.Only leader use this interface.getAllReplicaSets(int dataNodeId) Get all RegionGroups currently owned by the specified Database.Get all RegionGroups currently owned by this Database.intGet the DataNodes who contain the specific StorageGroup's Schema or Data.booleangetDataPartition(Map<TSeriesPartitionSlot, TTimeSlotList> partitionSlots, DataPartitionTable dataPartition) Thread-safely get DataPartition within the specific StorageGroup.Get the last DataAllotTable.getPredecessorDataPartition(TSeriesPartitionSlot seriesPartitionSlot, TTimePartitionSlot timePartitionSlot) Checks whether the specified DataPartition has a predecessor and returns if it does.intgetRegionCount(int dataNodeId, TConsensusGroupType type) Only leader use this interface.intGet the number of RegionGroups currently owned by this StorageGroup.List<org.apache.tsfile.utils.Pair<Long,TConsensusGroupId>> Only leader use this interface.getRegionId(TConsensusGroupType type, TSeriesPartitionSlot seriesSlotId, TTimePartitionSlot startTimeSlotId, TTimePartitionSlot endTimeSlotId) getRegionInfoList(GetRegionInfoListPlan regionsInfoPlan) getRegionType(int regionId) getReplicaSets(List<TConsensusGroupId> regionGroupIds) Get the RegionGroups with the specified RegionGroupIds.booleangetSchemaPartition(List<TSeriesPartitionSlot> partitionSlots, SchemaPartitionTable schemaPartition) Thread-safely get SchemaPartition within the specific StorageGroup.getSuccessorDataPartition(TSeriesPartitionSlot seriesPartitionSlot, TTimePartitionSlot timePartitionSlot) Checks whether the specified DataPartition has a successor and returns if it does.longgetTimeSlotList(TSeriesPartitionSlot seriesSlotId, TConsensusGroupId regionId, long startTime, long endTime) inthashCode()booleanvoidserialize(OutputStream outputStream, org.apache.thrift.protocol.TProtocol protocol) voidsetPreDeleted(boolean preDeleted) voidupdateDataNode(TDataNodeLocation newDataNodeLocation) Update the DataNodeLocation in cached RegionGroups.
-
Constructor Details
-
DatabasePartitionTable
-
-
Method Details
-
isNotPreDeleted
public boolean isNotPreDeleted() -
setPreDeleted
public void setPreDeleted(boolean preDeleted) -
updateDataNode
Update the DataNodeLocation in cached RegionGroups.- Parameters:
newDataNodeLocation- The new DataNodeLocation.
-
createRegionGroups
Cache allocation result of new RegionGroups.- Parameters:
replicaSets- List
-
getAllReplicaSets
- Returns:
- Deep copy of all Regions' RegionReplicaSet within one StorageGroup
-
getAllReplicaSets
Get all RegionGroups currently owned by this Database.- Parameters:
type- The specified TConsensusGroupType- Returns:
- Deep copy of all Regions' RegionReplicaSet with the specified TConsensusGroupType
-
getAllReplicaSets
Get all RegionGroups currently owned by the specified Database.- Parameters:
dataNodeId- The specified dataNodeId- Returns:
- Deep copy of all RegionGroups' RegionReplicaSet with the specified dataNodeId
-
getReplicaSets
Get the RegionGroups with the specified RegionGroupIds.- Parameters:
regionGroupIds- The specified RegionGroupIds- Returns:
- Deep copy of the RegionGroups with the specified RegionGroupIds
-
getRegionCount
Only leader use this interface.Get the number of Regions currently owned by the specified DataNode
- Parameters:
dataNodeId- The specified DataNodetype- SchemaRegion or DataRegion- Returns:
- The number of Regions currently owned by the specified DataNode
-
countDataNodeScatterWidth
Only leader use this interface.Count the scatter width of the specified DataNode
- Parameters:
dataNodeId- The specified DataNodetype- SchemaRegion or DataRegionscatterSet- The DataNodes in the cluster which have at least one identical schema/data replica as the specified DataNode will be set true in the scatterSet.
-
getRegionGroupCount
Get the number of RegionGroups currently owned by this StorageGroup.- Parameters:
type- SchemaRegion or DataRegion- Returns:
- The number of Regions currently owned by this StorageGroup
-
getAllRegionGroupIds
Only leader use this interface.Get all the RegionGroups currently owned by the specified Database
- Parameters:
type- SchemaRegion or DataRegion- Returns:
- List of TConsensusGroupId
-
getAssignedSeriesPartitionSlotsCount
public int getAssignedSeriesPartitionSlotsCount() -
getSchemaPartition
public boolean getSchemaPartition(List<TSeriesPartitionSlot> partitionSlots, SchemaPartitionTable schemaPartition) Thread-safely get SchemaPartition within the specific StorageGroup.- Parameters:
partitionSlots- SeriesPartitionSlotsschemaPartition- Where the results are stored- Returns:
- True if all the SeriesPartitionSlots are matched, false otherwise
-
getDataPartition
public boolean getDataPartition(Map<TSeriesPartitionSlot, TTimeSlotList> partitionSlots, DataPartitionTable dataPartition) Thread-safely get DataPartition within the specific StorageGroup.- Parameters:
partitionSlots- SeriesPartitionSlots and TimePartitionSlotsdataPartition- Where the results are stored- Returns:
- True if all the PartitionSlots are matched, false otherwise
-
getSuccessorDataPartition
public TConsensusGroupId getSuccessorDataPartition(TSeriesPartitionSlot seriesPartitionSlot, TTimePartitionSlot timePartitionSlot) Checks whether the specified DataPartition has a successor and returns if it does.- Parameters:
seriesPartitionSlot- Corresponding SeriesPartitionSlottimePartitionSlot- Corresponding TimePartitionSlot- Returns:
- The specific DataPartition's successor if exists, null otherwise
-
getPredecessorDataPartition
public TConsensusGroupId getPredecessorDataPartition(TSeriesPartitionSlot seriesPartitionSlot, TTimePartitionSlot timePartitionSlot) Checks whether the specified DataPartition has a predecessor and returns if it does.- Parameters:
seriesPartitionSlot- Corresponding SeriesPartitionSlottimePartitionSlot- Corresponding TimePartitionSlot- Returns:
- The specific DataPartition's predecessor if exists, null otherwise
-
createSchemaPartition
Create SchemaPartition within the specific StorageGroup.- Parameters:
assignedSchemaPartition- Assigned result
-
createDataPartition
Create DataPartition within the specific StorageGroup.- Parameters:
assignedDataPartition- Assigned result
-
filterUnassignedSchemaPartitionSlots
public List<TSeriesPartitionSlot> filterUnassignedSchemaPartitionSlots(List<TSeriesPartitionSlot> partitionSlots) Only Leader use this interface. Filter unassigned SchemaPartitionSlots within the specific StorageGroup.- Parameters:
partitionSlots- List- Returns:
- Unassigned PartitionSlots
-
getDatabaseRelatedDataNodes
Get the DataNodes who contain the specific StorageGroup's Schema or Data.- Parameters:
type- SchemaRegion or DataRegion- Returns:
- Set
, the related DataNodes
-
filterUnassignedDataPartitionSlots
public Map<TSeriesPartitionSlot,TTimeSlotList> filterUnassignedDataPartitionSlots(Map<TSeriesPartitionSlot, TTimeSlotList> partitionSlots) Only Leader use this interface. Filter unassigned DataPartitionSlots within the specific StorageGroup.- Parameters:
partitionSlots- List- Returns:
- Unassigned PartitionSlots
-
getRegionGroupSlotsCounter
public List<org.apache.tsfile.utils.Pair<Long,TConsensusGroupId>> getRegionGroupSlotsCounter(TConsensusGroupType type) Only leader use this interface.- Parameters:
type- SchemaRegion or DataRegion- Returns:
- RegionGroups' slot count and index
-
getRegionInfoList
-
serialize
public void serialize(OutputStream outputStream, org.apache.thrift.protocol.TProtocol protocol) throws IOException, org.apache.thrift.TException - Throws:
IOExceptionorg.apache.thrift.TException
-
deserialize
public void deserialize(InputStream inputStream, org.apache.thrift.protocol.TProtocol protocol) throws IOException, org.apache.thrift.TException - Throws:
IOExceptionorg.apache.thrift.TException
-
getRegionId
public List<TConsensusGroupId> getRegionId(TConsensusGroupType type, TSeriesPartitionSlot seriesSlotId, TTimePartitionSlot startTimeSlotId, TTimePartitionSlot endTimeSlotId) -
getTimeSlotList
public List<TTimePartitionSlot> getTimeSlotList(TSeriesPartitionSlot seriesSlotId, TConsensusGroupId regionId, long startTime, long endTime) -
getTimeSlotCount
public long getTimeSlotCount() -
getSeriesSlotList
-
containRegionGroup
Check if the DatabasePartitionTable contains the specified Region.- Parameters:
regionId- TConsensusGroupId- Returns:
- True if contains.
-
getDatabaseName
-
getSchemaRegionIds
-
getDataRegionIds
-
getRegionType
-
getLastDataAllotTable
Get the last DataAllotTable.- Returns:
- The last DataAllotTable
-
autoCleanPartitionTable
Remove PartitionTable where the TimeSlot is expired.- Parameters:
TTL- The Time To LivecurrentTimeSlot- The current TimeSlot
-
equals
-
hashCode
public int hashCode()
-