Class ClusterSchemaManager
java.lang.Object
org.apache.iotdb.confignode.manager.schema.ClusterSchemaManager
The ClusterSchemaManager Manages cluster schemaengine read and write requests.
-
Constructor Summary
ConstructorsConstructorDescriptionClusterSchemaManager(IManager configManager, ClusterSchemaInfo clusterSchemaInfo, ClusterSchemaQuotaStatistics schemaQuotaStatistics) -
Method Summary
Modifier and TypeMethodDescriptionvoidOnly leader use this interface.alterDatabase(DatabaseSchemaPlan databaseSchemaPlan, boolean isGeneratedByPipe) Alter Databasestatic intcalcMaxRegionGroupNum(int minRegionGroupNum, double resourceWeight, int resource, int databaseNum, int replicationFactor, int allocatedRegionGroupCount) checkIsTemplateSetOnPath(String templateName, String path) voidcountMatchedDatabases(CountDatabasePlan countDatabasePlan) Count Databases by specified path pattern.createTemplate(CreateSchemaTemplatePlan createSchemaTemplatePlan) create schemaengine templatedeleteDatabase(DeleteDatabasePlan deleteDatabasePlan, boolean isGeneratedByPipe) Delete DatabaseSchema.dropSchemaTemplate(String templateName) extendSchemaTemplate(TemplateExtendInfo templateExtendInfo, boolean isGeneratedByPipe) show schemaengine templatebyte[]get all template set and pre-set info to sync to a registering dataNodes, the pre unset template info won't be takengetDatabaseNameByDevice(String devicePath) Only leader use this interface.Only leader use this interface.getDatabaseSchemaByName(String database) Only leader use this interface.getMatchedDatabaseSchema(GetDatabasePlan getDatabasePlan) Get DatabaseSchemas by specified path pattern.getMatchedDatabaseSchemasByName(List<String> rawPathList) Only leader use this interface.Only leader use this interface.intgetMaxRegionGroupNum(String database, TConsensusGroupType consensusGroupType) Only leader use this interface.intgetMinRegionGroupNum(String database, TConsensusGroupType consensusGroupType) Only leader use this interface.getPathsSetTemplate(String templateName, PathPatternTree scope) show path set template xxintgetReplicationFactor(String database, TConsensusGroupType consensusGroupType) Only leader use this interface.Only leader use this interface.getTemplate(int id) Get template by id.getTemplate(String req) show nodes in schemaengine templategetTemplateSetInfo(List<PartialPath> patternList) booleanisDatabaseExist(String database) Check if the specified Database existspreUnsetSchemaTemplate(int templateId, PartialPath path) rollbackPreUnsetSchemaTemplate(int templateId, PartialPath path) setDatabase(DatabaseSchemaPlan databaseSchemaPlan, boolean isGeneratedByPipe) Set DatabasesetDataReplicationFactor(SetDataReplicationFactorPlan setDataReplicationFactorPlan) setSchemaReplicationFactor(SetSchemaReplicationFactorPlan setSchemaReplicationFactorPlan) setTimePartitionInterval(SetTimePartitionIntervalPlan setTimePartitionIntervalPlan) showDatabase(GetDatabasePlan getDatabasePlan) Only used in cluster tool show Databases.unsetSchemaTemplateInBlackList(int templateId, PartialPath path, boolean isGeneratedByPipe) voidupdateDeviceUsage(Map<Integer, Long> deviceUsage) voidupdateSchemaQuotaConfiguration(long seriesThreshold, long deviceThreshold) voidupdateTimeSeriesUsage(Map<Integer, Long> seriesUsage)
-
Constructor Details
-
ClusterSchemaManager
public ClusterSchemaManager(IManager configManager, ClusterSchemaInfo clusterSchemaInfo, ClusterSchemaQuotaStatistics schemaQuotaStatistics)
-
-
Method Details
-
setDatabase
Set Database -
alterDatabase
Alter Database -
deleteDatabase
Delete DatabaseSchema. -
countMatchedDatabases
Count Databases by specified path pattern. Notice: including pre-deleted Database.Notice: Only invoke this interface in ConfigManager
- Returns:
- CountDatabaseResp
-
getMatchedDatabaseSchema
Get DatabaseSchemas by specified path pattern. Notice: including pre-deleted DatabaseNotice: Only invoke this interface in ConfigManager
- Returns:
- DatabaseSchemaResp
-
showDatabase
Only used in cluster tool show Databases. -
getTTLInfoForUpgrading
-
setSchemaReplicationFactor
public TSStatus setSchemaReplicationFactor(SetSchemaReplicationFactorPlan setSchemaReplicationFactorPlan) -
setDataReplicationFactor
-
setTimePartitionInterval
-
adjustMaxRegionGroupNum
public void adjustMaxRegionGroupNum()Only leader use this interface. Adjust the maxSchemaRegionGroupNum and maxDataRegionGroupNum of each Database based on existing cluster resources -
calcMaxRegionGroupNum
public static int calcMaxRegionGroupNum(int minRegionGroupNum, double resourceWeight, int resource, int databaseNum, int replicationFactor, int allocatedRegionGroupCount) -
isDatabaseExist
Check if the specified Database exists- Parameters:
database- The specified Database- Returns:
- True if the DatabaseSchema is exists and the Database is not pre-deleted
-
getDatabaseNames
Only leader use this interface. Get all Databases name- Returns:
- List
, all Databases' name
-
getDatabaseSchemaByName
Only leader use this interface. Get the specified Database's schemaengine- Parameters:
database- DatabaseName- Returns:
- The specific DatabaseSchema
- Throws:
DatabaseNotExistsException- When the specific Database doesn't exist
-
getDatabaseNameByDevice
Only leader use this interface.- Returns:
- The DatabaseName of the specified Device. Empty String if not exists.
-
getMatchedDatabaseSchemasByName
Only leader use this interface. Get the specified Databases' schemaengine- Parameters:
rawPathList- List- Returns:
- the matched DatabaseSchemas
-
getMatchedDatabaseSchemasByPrefix
Only leader use this interface. Get the specified Databases' schemaengine- Parameters:
prefix- prefix full path- Returns:
- the matched DatabaseSchemas
-
getReplicationFactor
public int getReplicationFactor(String database, TConsensusGroupType consensusGroupType) throws DatabaseNotExistsException Only leader use this interface. Get the replication factor of specified Database- Parameters:
database- DatabaseNameconsensusGroupType- SchemaRegion or DataRegion- Returns:
- SchemaReplicationFactor or DataReplicationFactor
- Throws:
DatabaseNotExistsException- When the specific Database doesn't exist
-
getMinRegionGroupNum
Only leader use this interface. Get the maxRegionGroupNum of specified Database.- Parameters:
database- DatabaseNameconsensusGroupType- SchemaRegion or DataRegion- Returns:
- minSchemaRegionGroupNum or minDataRegionGroupNum
-
getMaxRegionGroupNum
Only leader use this interface. Get the maxRegionGroupNum of specified Database.- Parameters:
database- DatabaseNameconsensusGroupType- SchemaRegion or DataRegion- Returns:
- maxSchemaRegionGroupNum or maxDataRegionGroupNum
-
createTemplate
create schemaengine template- Parameters:
createSchemaTemplatePlan- CreateSchemaTemplatePlan- Returns:
- TSStatus
-
getAllTemplates
show schemaengine template- Returns:
- TGetAllTemplatesResp
-
getTemplate
show nodes in schemaengine template -
getTemplate
Get template by id. Only leader uses this interface.- Throws:
MetadataException
-
getPathsSetTemplate
show path set template xx -
getAllTemplateSetInfo
public byte[] getAllTemplateSetInfo()get all template set and pre-set info to sync to a registering dataNodes, the pre unset template info won't be taken -
getTemplateSetInfo
-
checkIsTemplateSetOnPath
-
preUnsetSchemaTemplate
-
rollbackPreUnsetSchemaTemplate
-
unsetSchemaTemplateInBlackList
public TSStatus unsetSchemaTemplateInBlackList(int templateId, PartialPath path, boolean isGeneratedByPipe) -
dropSchemaTemplate
-
extendSchemaTemplate
public TSStatus extendSchemaTemplate(TemplateExtendInfo templateExtendInfo, boolean isGeneratedByPipe) -
getSchemaQuotaRemain
Only leader use this interface. Get the remain schema quota of specified schema region.- Returns:
- pair of <series quota, device quota>, -1 means no limit
-
updateTimeSeriesUsage
-
updateDeviceUsage
-
updateSchemaQuotaConfiguration
public void updateSchemaQuotaConfiguration(long seriesThreshold, long deviceThreshold) -
clearSchemaQuotaCache
public void clearSchemaQuotaCache()
-