AMashenkov commented on a change in pull request #9423:
URL: https://github.com/apache/ignite/pull/9423#discussion_r711978255
##########
File path:
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/stat/IgniteStatisticsManagerImpl.java
##########
@@ -297,78 +332,104 @@ public IgniteStatisticsConfigurationManager
statisticConfiguration() {
/** {@inheritDoc} */
@Override public StatisticsUsageState usageState() {
- return usageState.getOrDefault(DEFAULT_STATISTICS_USAGE_STATE);
+ return (lastUsageState == null) ? DEFAULT_STATISTICS_USAGE_STATE :
lastUsageState;
}
/** {@inheritDoc} */
@Override public void onRowUpdated(String schemaName, String objName, int
partId, byte[] keyBytes) {
- try {
- if (statCfgMgr.config(new StatisticsKey(schemaName, objName)) !=
null)
- statsRepos.addRowsModified(new StatisticsKey(schemaName,
objName), partId, keyBytes);
- }
- catch (IgniteCheckedException e) {
- if (log.isInfoEnabled())
- log.info(String.format("Error while obsolescence key in %s.%s
due to %s", schemaName, objName,
- e.getMessage()));
- }
+ statsRepos.addRowsModified(new StatisticsKey(schemaName, objName),
partId, keyBytes);
}
/**
* 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.
*/
public synchronized void processObsolescence() {
- Map<StatisticsKey, IntMap<ObjectPartitionStatisticsObsolescence>>
dirty = statsRepos.saveObsolescenceInfo();
+ StatisticsUsageState state = usageState();
- Map<StatisticsKey, List<Integer>> tasks =
calculateObsolescenceRefreshTasks(dirty);
-
- if (!F.isEmpty(tasks))
- if (log.isTraceEnabled())
- log.trace(String.format("Refreshing statistics for %d
targets", tasks.size()));
+ if (state != ON || ctx.isStopping()) {
+ if (log.isDebugEnabled())
+ log.debug("Skipping obsolescence processing.");
- for (Map.Entry<StatisticsKey, List<Integer>> objTask :
tasks.entrySet()) {
- GridH2Table tbl = schemaMgr.dataTable(objTask.getKey().schema(),
objTask.getKey().obj());
+ return;
+ }
Review comment:
The second condition looks ambiguous.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]