Class IgniteStatisticsPersistenceStoreImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.query.stat.IgniteStatisticsPersistenceStoreImpl
-
- All Implemented Interfaces:
MetastorageLifecycleListener,IgniteStatisticsStore
public class IgniteStatisticsPersistenceStoreImpl extends Object implements IgniteStatisticsStore, MetastorageLifecycleListener
Sql statistics storage in metastore. Will store all statistics related objects with prefix "stats." Store only partition level statistics.
-
-
Constructor Summary
Constructors Constructor Description IgniteStatisticsPersistenceStoreImpl(GridInternalSubscriptionProcessor subscriptionProcessor, IgniteCacheDatabaseSharedManager db, Function<Class<?>,IgniteLogger> logSupplier)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearAllStatistics()Clear statistics of any type for any objects;voidclearLocalPartitionsStatistics(StatisticsKey key)Clear partition statistics for specified object.voidclearLocalPartitionsStatistics(StatisticsKey key, Collection<Integer> partIds)Clear partitions statistics.voidclearLocalPartitionStatistics(StatisticsKey key, int partId)Clear partition statistics.voidclearObsolescenceInfo(StatisticsKey key, Collection<Integer> partIds)Remove obsolescence info for the given key and partitions (if specified).Map<StatisticsKey,Collection<ObjectPartitionStatisticsImpl>>getAllLocalPartitionsStatistics(String schema)Get all local partition statistics.Collection<ObjectPartitionStatisticsImpl>getLocalPartitionsStatistics(StatisticsKey key)Get local partition statistics by specified object.ObjectPartitionStatisticsImplgetLocalPartitionStatistics(StatisticsKey key, int partId)Get partition statistics.Map<StatisticsKey,IntMap<ObjectPartitionStatisticsObsolescence>>loadAllObsolescence()Load all obsolescence info from store.Collection<Integer>loadLocalPartitionMap(StatisticsKey key)Load partitions map by key.voidonReadyForRead(ReadOnlyMetastorage metastorage)Is called when metastorage is made ready for read-only operations very early on node startup phase.voidonReadyForReadWrite(ReadWriteMetastorage metastorage)Fully functional metastore capable of performing reading and writing operations.voidreplaceLocalPartitionsStatistics(StatisticsKey key, Collection<ObjectPartitionStatisticsImpl> statistics)Replace all tables partition statistics with specified ones.voidsaveLocalPartitionStatistics(StatisticsKey key, ObjectPartitionStatisticsImpl stat)Save partition statistics.voidsaveObsolescenceInfo(Map<StatisticsKey,IntMap<ObjectPartitionStatisticsObsolescence>> obsolescence)voidsaveObsolescenceInfo(StatisticsKey key, int partId, ObjectPartitionStatisticsObsolescence partObs)Save obsolescence info.
-
-
-
Field Detail
-
VERSION
public static final Integer VERSION
Actual statistics version.
-
-
Constructor Detail
-
IgniteStatisticsPersistenceStoreImpl
public IgniteStatisticsPersistenceStoreImpl(GridInternalSubscriptionProcessor subscriptionProcessor, IgniteCacheDatabaseSharedManager db, Function<Class<?>,IgniteLogger> logSupplier)
Constructor.- Parameters:
subscriptionProcessor- Grid subscription processor to track metastorage availability.db- Database shared manager to lock db while reading/writing metastorage.logSupplier- Logger getting function.
-
-
Method Detail
-
onReadyForRead
public void onReadyForRead(ReadOnlyMetastorage metastorage)
Is called when metastorage is made ready for read-only operations very early on node startup phase. Reference for read-only metastorage should be used only within this method and shouldn't be stored to any field.- Specified by:
onReadyForReadin interfaceMetastorageLifecycleListener- Parameters:
metastorage- Read-only meta storage.
-
onReadyForReadWrite
public void onReadyForReadWrite(ReadWriteMetastorage metastorage) throws IgniteCheckedException
Fully functional metastore capable of performing reading and writing operations. Components interested in using metastore are allowed to keep reference passed into the method in their fields.- Specified by:
onReadyForReadWritein interfaceMetastorageLifecycleListener- Parameters:
metastorage- Fully functional meta storage.- Throws:
IgniteCheckedException
-
clearAllStatistics
public void clearAllStatistics()
Clear statistics of any type for any objects;- Specified by:
clearAllStatisticsin interfaceIgniteStatisticsStore
-
getAllLocalPartitionsStatistics
public Map<StatisticsKey,Collection<ObjectPartitionStatisticsImpl>> getAllLocalPartitionsStatistics(String schema)
Get all local partition statistics.- Specified by:
getAllLocalPartitionsStatisticsin interfaceIgniteStatisticsStore- Parameters:
schema- Schema name, ifnull- returl local partitions statistics for all schemas.- Returns:
- Map with all local partitions statistics.
-
replaceLocalPartitionsStatistics
public void replaceLocalPartitionsStatistics(StatisticsKey key, Collection<ObjectPartitionStatisticsImpl> statistics)
Replace all tables partition statistics with specified ones.- Specified by:
replaceLocalPartitionsStatisticsin interfaceIgniteStatisticsStore- Parameters:
key- Statistics key to replace statistics by.statistics- Collection of partition level statistics.
-
getLocalPartitionsStatistics
public Collection<ObjectPartitionStatisticsImpl> getLocalPartitionsStatistics(StatisticsKey key)
Get local partition statistics by specified object.- Specified by:
getLocalPartitionsStatisticsin interfaceIgniteStatisticsStore- Parameters:
key- Key to get statistics by.- Returns:
- Collection of partitions statistics.
-
clearLocalPartitionsStatistics
public void clearLocalPartitionsStatistics(StatisticsKey key)
Clear partition statistics for specified object.- Specified by:
clearLocalPartitionsStatisticsin interfaceIgniteStatisticsStore- Parameters:
key- Key to clear statistics by.
-
saveLocalPartitionStatistics
public void saveLocalPartitionStatistics(StatisticsKey key, ObjectPartitionStatisticsImpl stat)
Save partition statistics.- Specified by:
saveLocalPartitionStatisticsin interfaceIgniteStatisticsStore- Parameters:
key- Object which partition statistics belongs to.stat- Statistics to save.
-
getLocalPartitionStatistics
public ObjectPartitionStatisticsImpl getLocalPartitionStatistics(StatisticsKey key, int partId)
Get partition statistics.- Specified by:
getLocalPartitionStatisticsin interfaceIgniteStatisticsStore- Parameters:
key- Key to get partition statistics by.partId- Partition id.- Returns:
- Object partition statistics or
nullif there are no statistics collected for such partition.
-
clearLocalPartitionStatistics
public void clearLocalPartitionStatistics(StatisticsKey key, int partId)
Clear partition statistics.- Specified by:
clearLocalPartitionStatisticsin interfaceIgniteStatisticsStore- Parameters:
key- Object which statistics needs to be cleaned.partId- Partition id.
-
clearLocalPartitionsStatistics
public void clearLocalPartitionsStatistics(StatisticsKey key, Collection<Integer> partIds)
Clear partitions statistics.- Specified by:
clearLocalPartitionsStatisticsin interfaceIgniteStatisticsStore- Parameters:
key- Object which statistics need to be cleaned.partIds- Collection of partition ids.
-
saveObsolescenceInfo
public void saveObsolescenceInfo(Map<StatisticsKey,IntMap<ObjectPartitionStatisticsObsolescence>> obsolescence)
- Specified by:
saveObsolescenceInfoin interfaceIgniteStatisticsStore- Parameters:
obsolescence- Statistics key to partId to obsolescence info map to save.
-
saveObsolescenceInfo
public void saveObsolescenceInfo(StatisticsKey key, int partId, ObjectPartitionStatisticsObsolescence partObs)
Save obsolescence info.- Specified by:
saveObsolescenceInfoin interfaceIgniteStatisticsStore- Parameters:
key- Statistics key which it is belongs to.partId- Partition id.partObs- Info to save.
-
clearObsolescenceInfo
public void clearObsolescenceInfo(StatisticsKey key, Collection<Integer> partIds)
Remove obsolescence info for the given key and partitions (if specified).- Specified by:
clearObsolescenceInfoin interfaceIgniteStatisticsStore- Parameters:
key- Statistics key to remove obsolescense info by.partIds- Partition ids, ifnull- remove all partitions info for specified key.
-
loadAllObsolescence
public Map<StatisticsKey,IntMap<ObjectPartitionStatisticsObsolescence>> loadAllObsolescence()
Load all obsolescence info from store.- Specified by:
loadAllObsolescencein interfaceIgniteStatisticsStore- Returns:
- StatisticsKey to partitionId to obsolescence info map.
-
loadLocalPartitionMap
public Collection<Integer> loadLocalPartitionMap(StatisticsKey key)
Load partitions map by key.- Specified by:
loadLocalPartitionMapin interfaceIgniteStatisticsStore- Parameters:
key- Staistics key to load map by.- Returns:
- Collection of all partition ids for which there are local partitions statistics.
-
-