Class PartitionCache


  • public class PartitionCache
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      PartitionCache()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.iotdb.commons.partition.DataPartition getDataPartition​(java.util.Map<java.lang.String,​java.util.List<org.apache.iotdb.commons.partition.DataPartitionQueryParam>> storageGroupToQueryParamsMap)
      get dataPartition by query param map
      java.util.Map<java.lang.String,​java.lang.String> getDeviceToStorageGroup​(java.util.List<java.lang.String> devicePaths, boolean secondTry, boolean isAutoCreate)
      get device to storage group map
      org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet getRegionReplicaSet​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId)
      get regionReplicaSet from local and confignode
      org.apache.iotdb.commons.partition.SchemaPartition getSchemaPartition​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> storageGroupToDeviceMap)
      get schemaPartition
      java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getStorageGroupToDevice​(java.util.List<java.lang.String> devicePaths, boolean secondTry, boolean isAutoCreate)
      get storage group to device map
      void invalidAllCache()  
      void invalidAllDataPartitionCache()
      invalid all dataPartitionCache
      void invalidAllSchemaPartitionCache()
      invalid all schemaPartitionCache
      void invalidDataPartitionCache​(java.lang.String storageGroup)
      invalid dataPartitionCache by storageGroup
      void invalidReplicaSetCache()
      invalid replicaSetCache
      void invalidSchemaPartitionCache​(java.lang.String storageGroupName)
      invalid schemaPartitionCache by storage group
      void removeFromStorageGroupCache()
      invalid all storage group cache
      void removeFromStorageGroupCache​(java.util.List<java.lang.String> storageGroupNames)
      invalid storage group cache
      java.lang.String toString()  
      void updateDataPartitionCache​(java.util.Map<java.lang.String,​java.util.Map<org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot,​java.util.Map<org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot,​java.util.List<org.apache.iotdb.common.rpc.thrift.TConsensusGroupId>>>> dataPartitionTable)
      update dataPartitionCache by dataPartition
      boolean updateGroupIdToReplicaSetMap​(long timestamp, java.util.Map<org.apache.iotdb.common.rpc.thrift.TConsensusGroupId,​org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet> map)
      update regionReplicaSetMap according to timestamp
      void updateSchemaPartitionCache​(java.util.Map<java.lang.String,​java.util.Map<org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot,​org.apache.iotdb.common.rpc.thrift.TConsensusGroupId>> schemaPartitionTable)
      update schemaPartitionCache by schemaPartition.
      void updateStorageCache​(java.util.Set<java.lang.String> storageGroupNames)
      update storage group cache
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PartitionCache

        public PartitionCache()
    • Method Detail

      • getStorageGroupToDevice

        public java.util.Map<java.lang.String,​java.util.List<java.lang.String>> getStorageGroupToDevice​(java.util.List<java.lang.String> devicePaths,
                                                                                                              boolean secondTry,
                                                                                                              boolean isAutoCreate)
        get storage group to device map
        Parameters:
        devicePaths - the devices that need to hit
        secondTry - whether try to get all storage group from confignode
        isAutoCreate - whether auto create storage group when cache miss
      • getDeviceToStorageGroup

        public java.util.Map<java.lang.String,​java.lang.String> getDeviceToStorageGroup​(java.util.List<java.lang.String> devicePaths,
                                                                                              boolean secondTry,
                                                                                              boolean isAutoCreate)
        get device to storage group map
        Parameters:
        devicePaths - the devices that need to hit
        secondTry - whether try to get all storage group from confignode
        isAutoCreate - whether auto create storage group when cache miss
      • updateStorageCache

        public void updateStorageCache​(java.util.Set<java.lang.String> storageGroupNames)
        update storage group cache
        Parameters:
        storageGroupNames - the storage group names that need to update
      • removeFromStorageGroupCache

        public void removeFromStorageGroupCache​(java.util.List<java.lang.String> storageGroupNames)
        invalid storage group cache
        Parameters:
        storageGroupNames - the storage groups that need to invalid
      • removeFromStorageGroupCache

        public void removeFromStorageGroupCache()
        invalid all storage group cache
      • getRegionReplicaSet

        public org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet getRegionReplicaSet​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId consensusGroupId)
        get regionReplicaSet from local and confignode
        Parameters:
        consensusGroupId - the id of consensus group
        Returns:
        regionReplicaSet
        Throws:
        java.lang.RuntimeException - if failed to get regionReplicaSet from confignode
        StatementAnalyzeException - if there are exception when try to get latestRegionRouteMap
      • updateGroupIdToReplicaSetMap

        public boolean updateGroupIdToReplicaSetMap​(long timestamp,
                                                    java.util.Map<org.apache.iotdb.common.rpc.thrift.TConsensusGroupId,​org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet> map)
        update regionReplicaSetMap according to timestamp
        Parameters:
        timestamp - the timestamp of map that need to update
        map - consensusGroupId to regionReplicaSet map
        Returns:
        true if update successfully or false when map is not latest
      • invalidReplicaSetCache

        public void invalidReplicaSetCache()
        invalid replicaSetCache
      • getSchemaPartition

        public org.apache.iotdb.commons.partition.SchemaPartition getSchemaPartition​(java.util.Map<java.lang.String,​java.util.List<java.lang.String>> storageGroupToDeviceMap)
        get schemaPartition
        Parameters:
        storageGroupToDeviceMap - storage group to devices map
        Returns:
        SchemaPartition of storageGroupToDeviceMap
      • updateSchemaPartitionCache

        public void updateSchemaPartitionCache​(java.util.Map<java.lang.String,​java.util.Map<org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot,​org.apache.iotdb.common.rpc.thrift.TConsensusGroupId>> schemaPartitionTable)
        update schemaPartitionCache by schemaPartition.
        Parameters:
        schemaPartitionTable - storage group to SeriesPartitionSlot to ConsensusGroupId map
      • invalidSchemaPartitionCache

        public void invalidSchemaPartitionCache​(java.lang.String storageGroupName)
        invalid schemaPartitionCache by storage group
        Parameters:
        storageGroupName - the storage groups that need to invalid
      • invalidAllSchemaPartitionCache

        public void invalidAllSchemaPartitionCache()
        invalid all schemaPartitionCache
      • getDataPartition

        public org.apache.iotdb.commons.partition.DataPartition getDataPartition​(java.util.Map<java.lang.String,​java.util.List<org.apache.iotdb.commons.partition.DataPartitionQueryParam>> storageGroupToQueryParamsMap)
        get dataPartition by query param map
        Parameters:
        storageGroupToQueryParamsMap - storage group to dataPartitionQueryParam map
        Returns:
        DataPartition of storageGroupToQueryParamsMap
      • updateDataPartitionCache

        public void updateDataPartitionCache​(java.util.Map<java.lang.String,​java.util.Map<org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot,​java.util.Map<org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot,​java.util.List<org.apache.iotdb.common.rpc.thrift.TConsensusGroupId>>>> dataPartitionTable)
        update dataPartitionCache by dataPartition
        Parameters:
        dataPartitionTable - storage group to seriesPartitionSlot to timePartitionSlot to ConsensusGroupId map
      • invalidDataPartitionCache

        public void invalidDataPartitionCache​(java.lang.String storageGroup)
        invalid dataPartitionCache by storageGroup
        Parameters:
        storageGroup - the storage groups that need to invalid
      • invalidAllDataPartitionCache

        public void invalidAllDataPartitionCache()
        invalid all dataPartitionCache
      • invalidAllCache

        public void invalidAllCache()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object