Class IgniteStatisticsManagerImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.query.stat.IgniteStatisticsManagerImpl
-
- All Implemented Interfaces:
IgniteStatisticsManager
public class IgniteStatisticsManagerImpl extends Object implements IgniteStatisticsManager
Statistics manager implementation.
-
-
Constructor Summary
Constructors Constructor Description IgniteStatisticsManagerImpl(GridKernalContext ctx)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollectStatistics(StatisticsObjectConfiguration... targets)Gather object statistics.voiddropAll()Drop all statistics.voiddropStatistics(StatisticsTarget... targets)Clear object statistics.voidensureActive(String op)Check that cluster is active.ObjectStatisticsgetGlobalStatistics(StatisticsKey key)Get global statistics by object.ObjectStatisticsgetLocalStatistics(StatisticsKey key)Get local statistics by object.ObjectStatisticsImplgetLocalStatistics(StatisticsKey key, AffinityTopologyVersion topVer)Get local statitsics with specified topology version if exists.voidonRowUpdated(String schemaName, String objName, int partId, byte[] keyBytes)To track statistics invalidation.voidprocessObsolescence()Save dirty obsolescence info to local metastore.voidrefreshStatistics(StatisticsTarget... targets)Refresh object statistics.IgniteStatisticsConfigurationManagerstatisticConfiguration()IgniteStatisticsRepositorystatisticsRepository()voidstop()Stop statistic manager.voidsubscribeToLocalStatistics(Consumer<ObjectStatisticsEvent> subscriber)Subscribe to all local statistics changes.voidsubscribeToStatisticsConfig(Consumer<StatisticsObjectConfiguration> subscriber)Subscribe to all statistics configuration changed.StatisticsUsageStateusageState()voidusageState(StatisticsUsageState state)Set statistics usage state.
-
-
-
Constructor Detail
-
IgniteStatisticsManagerImpl
public IgniteStatisticsManagerImpl(GridKernalContext ctx)
Constructor.- Parameters:
ctx- Kernal context.
-
-
Method Detail
-
statisticsRepository
public IgniteStatisticsRepository statisticsRepository()
- Returns:
- Statistics repository.
-
getLocalStatistics
public ObjectStatistics getLocalStatistics(StatisticsKey key)
Get local statistics by object.- Specified by:
getLocalStatisticsin interfaceIgniteStatisticsManager- Parameters:
key- Statistic key.- Returns:
- Object statistics or
nullif there are no available statistics by specified object.
-
getLocalStatistics
public ObjectStatisticsImpl getLocalStatistics(StatisticsKey key, AffinityTopologyVersion topVer)
Get local statitsics with specified topology version if exists.- Parameters:
key- Key to get statistics by.topVer- Required topology version.- Returns:
- Local object statistics or
nullif there are no statistics with requested topology version.
-
getGlobalStatistics
public ObjectStatistics getGlobalStatistics(StatisticsKey key)
Get global statistics by object.- Specified by:
getGlobalStatisticsin interfaceIgniteStatisticsManager- Parameters:
key- Statistic key.- Returns:
- Object statistics of
nullif there are no available global statistics by specified object.
-
collectStatistics
public void collectStatistics(StatisticsObjectConfiguration... targets) throws IgniteCheckedException
Gather object statistics.- Specified by:
collectStatisticsin interfaceIgniteStatisticsManager- Parameters:
targets- Target to params map to gather statistics by.- Throws:
IgniteCheckedException- Throws in case of errors.
-
dropStatistics
public void dropStatistics(StatisticsTarget... targets) throws IgniteCheckedException
Clear object statistics.- Specified by:
dropStatisticsin interfaceIgniteStatisticsManager- Parameters:
targets- Collection of target to collect statistics by (schema, obj, columns).- Throws:
IgniteCheckedException- In case of errors (for example: unsupported feature)
-
refreshStatistics
public void refreshStatistics(StatisticsTarget... targets)
Refresh object statistics.- Specified by:
refreshStatisticsin interfaceIgniteStatisticsManager- Parameters:
targets- Target to refresh statistics by.
-
dropAll
public void dropAll()
Drop all statistics.- Specified by:
dropAllin interfaceIgniteStatisticsManager
-
stop
public void stop()
Stop statistic manager.- Specified by:
stopin interfaceIgniteStatisticsManager
-
statisticConfiguration
public IgniteStatisticsConfigurationManager statisticConfiguration()
- Returns:
- Statistics configuration manager.
-
usageState
public void usageState(StatisticsUsageState state)
Set statistics usage state.- Specified by:
usageStatein interfaceIgniteStatisticsManager- Parameters:
state- Statistics state.
-
usageState
public StatisticsUsageState usageState()
- Specified by:
usageStatein interfaceIgniteStatisticsManager- Returns:
- Statistics usage state.
-
onRowUpdated
public void onRowUpdated(String schemaName, String objName, int partId, byte[] keyBytes)
To track statistics invalidation. Skip value if no statistics for the given table exists.- Specified by:
onRowUpdatedin interfaceIgniteStatisticsManager- Parameters:
schemaName- Schema name.objName- Object name.partId- Partition id.keyBytes- Row key bytes.
-
processObsolescence
public void processObsolescence()
Save dirty obsolescence info to local metastore. Check if statistics need to be refreshed and schedule it. 1) Get all dirty partition statistics. 2) Make separate tasks for each key to avoid saving obsolescence info for removed partition (race). 3) Check if partition should be recollected and add it to list in its tables task. 4) Submit tasks. Actually obsolescence info will be stored during task processing.
-
subscribeToLocalStatistics
public void subscribeToLocalStatistics(Consumer<ObjectStatisticsEvent> subscriber)
Subscribe to all local statistics changes.- Parameters:
subscriber- Local statitics subscriber.
-
subscribeToStatisticsConfig
public void subscribeToStatisticsConfig(Consumer<StatisticsObjectConfiguration> subscriber)
Subscribe to all statistics configuration changed.- Parameters:
subscriber- Statistics configuration subscriber.
-
ensureActive
public void ensureActive(String op)
Check that cluster is active.- Parameters:
op- Operation name.
-
-